What is the difference between a Struct and a Class?

 Posted by Chikul on 12/21/2009 | Category: .NET Framework Interview questions | Views: 2342

Structs are Value type variables and are stored on the stack, while Class are Reference type variables and are stored on the heap.
Struct do not support inheritance, while class supports inheritance. However struct can implements interface.
Struct should be used when you want to use a small data structure, while Class is better choice for complex data structure.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response