Computer Applications
Define class and object with an example.
Objects & Classes
74 Likes
Answer
An object is an entity having a specific identity, specific characteristics and specific behaviour.
A class is a blue print that represents a set of objects that share common characteristics and behaviour.
Take the example of a house. An architect will have the blueprints for a house. Those blueprints will be plans that explain exactly what properties the house will have and how they are all laid out. However, it is just the blueprint, we can't live in it. Builders will look at the blueprints and use those blueprints to make a physical house. They can use the same blueprint to make as many houses as they want. Each house will have the same layout and properties. Each house can accommodate its own families. So, in this example, the blueprint is the class, the house is the object and the people living in the house are data stored in the object's properties.
Answered By
45 Likes