Pages

Saturday 12 January 2013

Difference between structs and classes

Difference between structs and classes

 
structs
classes
  • structs are value type
  • classes are reference type
  • structs are stored in stack or a inline
  • classes are stored on managed heap
  • structs doesn't support inheritance
  • classes support inheritance
  • But handing of constructor is different in structs. The complier supplies a default no-parameter constructor, which your are not permitted to replace
  • Constructors are fully supported in classes

No comments:

Post a Comment