Difference between Class and Struts

This blog shows the complete difference between Class and Structs

Class
Struct
Class is a reference type
Struct is a value type
Class supports inheritance
Struct will not support inheritance
Class variables are stored on Heap
Struct variables are stored on Stack
Class can have destructor
Struct will not have destructor
Boxing a class object creates reference to same object
Boxing a strut object will create a copy in diff type
All the members of Class are private by default 
All the members of struct are public by default
Class is well suited for Data hiding
Struts are not suited for Data hiding

Ebook Download
View all
Learn
View all