Sunday, 28 April 2013

What is the difference between Class and structure’s ? | C#.Net Interview Questions

Following are the key differences between them :-
Structure are value types and classes are reference types. So structures use stack and classes use heap.
Structures members can not be declared as protected, but class members can be. You can not do inheritance in structures.
Structures do not require constructors while classes require.
Objects created from classes are terminated using Garbage collector. Structures are not destroyed using GC.

No comments: