Discussion forum 01

Discussion forum 01

by Sahed Reza Sohan -
Number of replies: 0

Class                                                                               Object

1. Class is used as a template for declaring and            1. An object is an instance of a class.

creating the objects.      


2. When a class is created, no memory is allocated.      2.  Objects are allocated memory space whenever they                                                                                              are created.


3. The class has to be declared first and only once.       3.  An object is created many times as per requirement.


4. A class can not be manipulated as they are not        4.  Objects can be manipulated.

available in the memory.


5. A class is a logical entity.                                          5.  An object is a physical entity . 


6. Class does not contain any values which                   6. Each object has its own values, which are

   can be associated with the field.                                    associated with it.


7. A class is used to bind data as well as methods        7. Objects are like a variable of the class.

    together as a single unit. 

For example: Mobile is a class and Samsung ,  Nokia , Google pixel, Xiaomi etc is a object.