Advertisements
Advertisements
Questions
Differentiate classes and objects.
Differentiate between Class and Object.
Differentiate between an object and a class.
Distinguish Between
Advertisements
Solution 1
Class:
- A class is a blueprint or template from which objects are created.
- Class doesn’t allocate memory when it is created.
- Class is a logical entity.
Object:
- The object is an instance of a class.
- Objects allocate memory when it is created.
- The object is a physical entity.
shaalaa.com
Solution 2
| Basis of Difference | Class | Object |
|---|---|---|
| Meaning | A class is a blueprint or template for creating objects. | An object is a real instance of a class. |
| Nature | It is a logical definition. | It is a physical entity created in memory. |
| Creation | A class is defined using the class keyword. |
An object is created by calling the class. |
| Data values | It specifies attributes and methods in general. | It contains actual values for the attributes. |
| Example | Mobile_phone is a class. |
Nokia Lumia, Asha and i4 are objects of that class. |
shaalaa.com
Is there an error in this question or solution?
