7 VALUE TYPES AND POLYMORPHISM

As an object-oriented programming (OOP) language, C# has good support for features that allow us to capture complex ideas and express them intuitively, such as classes, virtual methods, and inheritance. However, the language support for inheritance doesn’t extend to value types. Structs and record structs implicitly derive from the ValueType class, which is derived directly from object,

but they can’t inherit any other type and can’t themselves be inherited; that is, structs and record structs are implicitly sealed. Inheritance is a central feature of OOP that enables us to treat a reference to a derived class ...

Get The C# Type System now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.