What is Class and object, How to declare an object in c++ oop, Example of class, object and attributes
In this tutorial, we will learn about the followings;
- What is a class?
- What is an object?
- What are attributes?
- Examples of object and attribute.
- How to declare a class?
What is a class?
A class is a big and generalized concept having attributes, functions, and objects.
What is an object?
An object can be any person, thing, place or an event etc.
What is an attribute?
Attributes are the properties of classes.
Example of class, object and attributes:
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?
<span style="font-family: arial, helvetica, sans-serif; font-size: 14pt;">class furniture
body of the class
|3||body of the class|
Line 1: Class is keyword and furniture is the class name.
Line 2: Starting body of the class
Line 3: Body of the class where we write attributes and functions of the class.
Line 4: Ending of the class.