+ 4
Main Difference Between Class And Object In C++
Inspite of reading so many time about classes n objects I'm still unable to understand the main difference or you can say their defination. can someone elaborate it please ? Thanks in advance 😊
6 Antworten
+ 5
@Faizal Reza
Class is not a subset. It is the set builder form of the object sets that helps define every object...
The main difference here is that this set builder form can be used to create more than one set at a time, each being the same or different.
So, assume a class as the blueprint of a thing , and the object as a particular model of the thing created using the blueprint...
Eg- Suppose you see a basic blueprint of a car, which explains that the car contains wheels, an engine of set horsepower, body of some shape, some mx speed limit, etc, etc... This blueprint can be thought of as a class.
Now you use this blueprint to create Bugatti Veryon, as it is a car and will also have all the items listed in the blueprint, just that now, everything will have a fixed value :
Eg- 4 wheels, 1248bhp engine, 350miles/h max speed, etc, etc...
Thus Bugatti veryon is an object created using the basic blueprint of a standard car...
+ 4
thnx @kinshuk Vasisht
+ 4
@Faizal Reza
Welcome.
Happy to help...
😊
+ 2
All Humans (class) talk, walk, and do something, but every person (object) has different names, works, etc.
+ 2
can I say class is subset of object ?
0
Class is the object type: Human.Object is an element of the class: John.