It is well known that C# class can inherit only from a Single Base class How does it make sense because all classes derive from System.Object?
Also, If I look into class ValueType definition (for example), which i know that inherits directly from System.Object, i see that it is just an abstract class. i expect to see: public abstract class ValueType : System.Object
It is well known that C# class can inherit only from a single base class.
That is not well-known because that statement is absolutely false. In C# a class can inherit members from arbitrarily many base classes and interfaces.
You have confused the inherits-members-from-type relationship with the directly-derives-from-type relationship.
The actual rule is that every class except System.Object derives directly from exactly one class. System.Object is unique in that it is the only class that derives directly from nothing.
Every class and every interface can derive directly from arbitrarily many interfaces.
A class or interface inherits the members of every class or interface that it derives from, either directly or indirectly. The "direct or indirect derivation" relationship is the transitive closure of the direct derivation relationship.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With