Difference between a Class and an object

 Posted by Pardhu2020 on 2/18/2014 | Category: C# Interview questions | Views: 506 | Points: 40
Answer:

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.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response