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 the 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 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 the attributes and functions of the class.

Line 4: Ending of the class.

By:Prof. Fazal Rehman Shamil
CEO @ T4Tutorials
Last Modified: February 27, 2020

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

  1. T4Tutorial is one of the perfect websites which I found more and more information…..

Leave a Reply

Your email address will not be published. Required fields are marked *