Please tell me the difference between class and object. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please tell me the difference between class and object.

28th Feb 2017, 4:34 AM
Satyam Jaiswal
Satyam Jaiswal - avatar
3 Answers
28th Feb 2017, 4:53 AM
Chirag Bhansali
Chirag Bhansali - avatar
+ 3
A class can be considered the blueprint of an object. If your Objects are many cookies you can consider the cookie cutter their class. Credit goes to Daniel Shiffman
28th Feb 2017, 5:33 AM
seamiki
seamiki - avatar
+ 2
Classes are nothing but custom datatypes. Objects are just instances of those datatypes. Consider 'int a' and 'MyClass obj'. Both of them imply the same thing. Integer is a built in datatype whereas MyClass is a datatype that you defined. Similarly, 'a' and 'obj' are objects of their respective classes/datatypes.
1st Mar 2017, 3:57 AM
Vimal Krishna
Vimal Krishna - avatar