Saturday, 1 October 2011

What are differences between Class and structure?


Following are the key differences between classes and structures :
  Structure are value types and classes are reference types. So structures use stack and classes use heap.
 Structures members cannot be declared as protected, but class members can be. You cannot do inheritance in structures. 
  Structures do not require constructors while classes require.

No comments:

Post a Comment