19 June 2014

Difference between a Class and an object ?


Class: 
1)It is a datatype that contains the programming logic. 
2)Class is visible in the source code and resides in hard disk. 
3)Class is like a template or blueprint of the object. It implements reusability, 
encapsulation, inheritance 
example:Button is a class with properties like Text,BackColor, 
events like click, methods like Focus 

Object: 
1)it is a chunk of memory that implements the class logic. 
2)Object is in the RAM and not visible in source code. 
3)It is the real world implementation of the class. 
Each object has its own copy of data. 
example: Button1, Button2 are the objects of Button class.

No comments:

Post a Comment