+ 1
How do you define object and class in interview?
what exactly I should tell
2 Answers
+ 6
Object is the representation of real objects that exist in world like. Classes are grouping more same object and define they attributes and behavior. Bmw, audi... will be objects and cars will be class.
+ 6
For myself, I think of classes as blueprints that we use in the physical world. You have a blueprint (class) that defines and maps out an object we want to create. The blueprint itself isn't the object, but simply the template of the object. We can use this blueprint to create instances of the object, and they'll operate as individual objects in our world. As such, you can manipulate and utilize an object independent of the other objects (although not limited to that), so they don't impact one another and you always have the original blueprint should you need to make more.
As an example, I do a lot of work with client-server software, and each individual client are objects created from the client class that I created. So everyone is built from the same template (class), but their members may have different values, such as the user's ID or other such data. If we need more clients, we can create more instances of the object.