What is difference between class and structure.


=>Structures are value types and classes are reference type. So structure use stack and classes use heap.

=> Structure members can't be declared as protected, But class member can be you can't do inheritance in structure.

=> Structure don't require constructor while classes require constructors.

=> Objects created from classes are terminated using garbage collector. Structure are not destroyed using garbage collector.

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2019 HART™ is a registered trademark.