What is the difference between classes and objects?
Ans:
A class is a blueprint for objects. From one class several objects can be created.
Each object is know as an instance of a particular class.
Simple term:
'Cricketers' is a class whereas 'Sachin','Ganguly' are instances of 'Cricketer' class (hence they are objects).
Programmers term:
In "int i",'int' is a class where as 'i' is an object.
In user defined class 'employee' is a class where as e1,e2,e3 are objects.
No comments:
Post a Comment