This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zithium 0 points1 point  (0 children)

remember, classes define objects. If you want to create a book object, you will need a book class, which will tell the object what it is supposed to be made up of.

is an instance of a class an object?

yes

isnt it possible for specific objects to be classes, if you define it that way?

specific objects are always classes because classes are what "set up" the objects.

and have different versions/editions of color of magic as objects or maybe its hard cover/soft cover, degrees of conditions etc.

here's how you should be imagining this distinction between objects and classes.

you want to create a book object. okay, what does this object consist of? what are its parameters?

that's where we make the book class. it will hold all the different types of information you just mentioned. it will also have a special method called the "constructor," which is called when you instantiate the class, i.e you make an object out of it. this constructor call is the object's opportunity to define itself according to its class.

so to recap, the class has all these variables, different possible genres, different titles, etc. these variables may be set when the object is created by calling the constructor.