Class :) — Class is a group of object which have common Properties
Class is a set of object which shares common characteristics/ behavior and common properties/ attributes.
Class is not a real-world entity. It is just a template or blueprint or prototype from which objects are created.
Class does not occupy memory.
Class is a group of variables of different data types and a group of methods.
For Examples :
Class is a 10th Standard and 10th Standard is a group of Student (many Student) . Then class is a 10th is Standard.
Object :) — Object is a represents real-life entities.An object is called an instance of a class.
An object consists of :
- State: It is represented by attributes of an object. It also reflects the properties of an object.
- Behavior: It is represented by the methods of an object. It also reflects the response of an object with other objects.
- Identity: It gives a unique name to an object and enables one object to interact with other objects
For example, suppose Bicycle is a class then MountainBicycle, SportsBicycle, TouringBicycle, etc can be considered as objects of the class.
Top comments (0)