Difference between Class and Object

Class vs Object
A class is a Blue print of an object. a general concept (like an Animal), an object is a very specific embodiment of that class, with a limited lifespan (like a lion, cat, or a zebra).

Class

  1. Definition: Class is mechanism of binding data members and associated methods in a single unit.
  2. Existence: It is logical existence
  3. Lifespan: Classes do not have a lifespan
  4. Memory Allocation: Memory space is not allocated , when it is created.
  5. Declaration/Definition: Definition is created once.

Object

  1. Definition: Instance of class or variable of class.
  2. Existence: It is physical existence
  3. Lifespan: Objects have a lifespan
  4. Memory Allocation: Memory space is allocated, when it is created.
  5. Declaration/Definition: it is created many time as you require.

Leave a Reply

Your email address will not be published. Required fields are marked *


3 + two =