What is a class in c++ ?

1 Like

in general variable of the class is called object .
An object is a region of storage with associated semantics. After the declaration int i;', we say thati is an object of type int’. In C++/OOP, object' is usually used to meanan instance of a class’.
Thus a class defines the behavior of possibly many objects

The fundamental building block of Object Oriented software.

A class defines a data type, much like a struct would be in C. In a computer science sense, a type consists of both a set of states and a set of operations which transition between those states. Thus int is a type because it has both a set of states and it has operations like i + j or i++, etc. In exactly the same way, a class provides a set of (usually public) operations, and a set of (usually non-public) data bits representing the abstract values that instances of the type can have.

You can imagine that int is a class that has member functions called operator++, etc.