Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (appleduardo):

what is an "object" in OOP?

OpenStudy (espex):

An object is just what it sounds like. A car is an object in the real world, it has variables of tires, engine, color, body type, etc.. In OOP you have an object, known as a class, for example, a class "car" that has instance variables of engine, tires, color, body type, etc.. In one case you have a physical object that you can touch, in the other you have a defined object that you can manipulate.

OpenStudy (appleduardo):

:O wow, thank you so! but how can i differentiate an object and a class?

OpenStudy (espex):

A class IS an object.

OpenStudy (anonymous):

I thought that a class defines an object but it's not the object itself. "The map isn't the territory", no ?

OpenStudy (anonymous):

diomit is right. There is a big difference between a class and an object. Take the example of a car. A specific type of car (let's say a Fiat Punto) has some basic functionality. That is comparable to a class. A class is a set of variables and functions that provide functionality to the user. Suppose that there are two brand new Fiat Puntos standing in front of you. Both are of the class 'Fiat Punto', since they have the same functionality. But the two cars are different objects. If the class 'Fiat Punto' defines e.g. a variable 'speed', both cars have a speed, but their speed can be different.

OpenStudy (konradzuse):

A car is an object... Everything is an object.

OpenStudy (appleduardo):

thank you all very much ! :D

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!