Software & Finance





C# - Difference between struct and class





Struct

Class

Value Type

Reference Type

No Inheritance, so members can not be declared as protected.

Inheritance is allowed.

Multiple Inheritance is NOT allowed

same as struct

Constructors and methods are allowed

same as struct

Finalize will act as a destructor

same as struct

Can have another class or reference type as a member variable 

same as struct