What is the Difference Between Class and structure


  •  Class is a written description of and object.
  • Class is a user define data types.
  • Class is a blue print of and objects
  • Class contain data and behaviors.
  • Class is the attributes of the objects.
  • Class is a logical entity.
  • A class is reference type.
  • While instantiating a class, CLR allocates memory for its instance in heap.
  • classes support inheritance
  • Variable of class assigned as null.
  • Class can contain constructor/destructor.


    • A structure is a value type.
    • In structure, memory is allocated on stack
    • Structures do not support inheritance.
    • Structure members cannot have null values.
    • Structure does not require constructor/destructor and members can be initialized automatically.

Post a Comment