Little drops on C# Interview Questions series
The intention behind this series is to answer with a little bit of context or examples of some of the most common C# interview questions.
Hey friends long time no see but continuing our series on class x structs
Struts are value-type variables stored on the stack as we talked about in Part 1 of this series and by consequence having faster retrieval, structs cannot be inherited.
Classes are as we say the blueprint of an object(which is a class instantiated) storing it on the heap, we can use a default constructor and we can use inheritance.
Classes are an overall blueprint for objects to be used and manipulated throughout the application, like domain objects.
Structs are data structures best suited for small primary data that is not intended to be modified after being created, like coordinates or other fixed data that you might need.
As @daviholandas said the structs can be allocated on the heap if its referenced by a reference type.
struct and classes can have constructors, constants, fields, methods, properties, indexers, operators, events and nested types.
struct and classes can implement interfaces.
struct does not support destructor or default constructor(parameterless).
Structs that does not support inheritance
members of structs cannot be specified as abstract, sealed, virtual, or protected.