Sonu Interview Question

Q : diff b/w class and object

Interview Answer

Anonymous

Jul 25, 2024

A class is a blueprint or template that defines the structure and behavior (data members and methods) that the objects created from the class will have. It is a logical entity. An object, on the other hand, is an instance of a class. It is a physical entity that occupies memory and has its own state and behavior as defined by the class. For example, if we have a class Car, it defines the properties like color, model, and speed, but an object of this class, say myCar, will have specific values for these properties.