The main difference between the 2 is that, STRUCTS are VALUE TYPES, while CLASSES are REFERENCE TYPES.
The Memory is divided in two areas: Stack(local) and Heap(instance).
On the Stack are stored the value types. On the Heap, the reference types are stored.
@ STRUCTS : - Don't support inheritance;
- A Struct is not allowed to inherit from another struct or class.
- Function member of the struct cannot be virtual or abstract.
@ CLASSES : - Support inheritance;
- can inherit from another class.
- Function member of the class can be virtual or abstract.
# STRUCTS : Cannot have null references;
# CLASSES : Can have null references;
* The data member of a class can be protected.
* The data member of struct can’t be protected.
$ STRUCTS : Light on logic, they support data;
$ CLASSES : Contain complex logic behind;
* A CLASS can have a parameterless constructor.
* A STRUCT does not contain parameter less constructor, but can contain Parameterized constructor or static constructor.
* Classes use new keyword for creating instances.
* Structs can create an instance, with or without new keyword.
Just like classes, a struct can also implement from an interface.
*Default value for classes: null;
*Default value for struct can not be null. The default value of a struct is the value produced by setting all value type fields to their default value and all reference type fields to null