Classes and Objects in OOP

What is class?

A class is a big and generalized concept having attributes, functions and objects.

What is object?

An object can be any person, thing, place or an event etc.

What is attribute?

Attributes are the properties of classes.



Class: Furniture

Object : Chair, Table etc

Attributes: Chair color, Chair price, Table size etc.

Functions : Add_Table, View_Table, Delete_Table, Update_table etc.


How to declare a class?

Line# Code
1 class furniture
2 {
3 body of the class
4 };

Line 1 : Class is keyword and furniture is class name.

Line 2: Starting body of class

Line 3: Body of the class where we write attributes and functions of the class.

Line 4: Ending of the class.