Class vs object in C++
In
object-oriented programming, a class is a blueprint for creating objects, which
are instances of the class. The class defines the characteristics and behavior
of the objects that will be created from it.
An object,
on the other hand, is an instance of a class. When you create an object, you
are creating a specific instance of that class, with its own set of values for
the class's attributes.
In simple
terms, a class is like a blueprint or a template, while an object is like an
actual building that has been constructed according to that blueprint.
Different between Class and object
Class
|
Object |
Class is
a collection of data member and member function. |
Object
is a instance of class. |
It doesn’t
exist without object. |
It exits
when class is defined. |
It does
not allocate the memory location. |
It allocated
the memory location. |
It
cannot manipulate the data. |
It manipulates
the data. |
0 Comments