What is Class and object, How to declare object in c++ oop, Example of class, object and attributes

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;

  1. What is a class?
  2. What is an object?
  3. What are attributes?
  4. Examples of object and attribute.
  5. 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:

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
1class furniture
2{
3body of the class
4};

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.