Explain the relationship between class and object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Explain the relationship between class and object

23rd Dec 2016, 8:50 AM
Emmanuel Agbozo
Emmanuel Agbozo - avatar
3 Answers
+ 2
Class is prescription for an object. Class defines a behavior for an object. Object is actual usage of such class, there can (and usually would) be more instances of same class. Consider class CartoonCharacter { ... }, then Tom would be one instance (object) and Jerry would be second (different) instance of the same class, in famous caroon Tom&Jerry
23rd Dec 2016, 9:10 AM
Termitt
Termitt - avatar
+ 1
An object is an instance of a class.
23rd Dec 2016, 10:28 PM
VPA
VPA - avatar
0
Thank you
23rd Dec 2016, 10:14 AM
Emmanuel Agbozo
Emmanuel Agbozo - avatar