A struct is a value type, while a class is a reference type. When we instantiate a class, memory will be allocated on the heap. When struct gets initiated, it gets memory on the stack. Classes can have explicit parameter less constructors. But structs cannot have this. Classes support inheritance. But there is no inheritance for structs. A struct cannot inherit from another struct or class, and
No comments:
Post a Comment