Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specification 17 Classes 17.2 Class members 17.2.1 Inheritance
Paragraph 11 A class inherits the members of its direct base class. 2 Inheritance means that a class implicitly contains all members of its direct base class, except for the instance constructors, destructors, and static constructors of the base class. 3 Some important aspects of inheritance are:
- 4 Inheritance is transitive. 5 If C is derived from B, and B is derived from A, then C inherits the members declared in B as well as the members declared in A.
- 6 A derived class extends its direct base class. 7 A derived class can add new members to those it inherits, but it cannot remove the definition of an inherited member.
- 8 Instance constructors, destructors, and static constructors are not inherited, but all other members are, regardless of their declared accessibility (§10.5). 9 However, depending on their declared accessibility, inherited members might not be accessible in a derived class.
- 10 A derived class can hide (§10.7.1.2) inherited members by declaring new members with the same name or signature. 11 Note however that hiding an inherited member does not remove that member-it merely makes that member inaccessible in the derived class.
- 12 An instance of a class contains a set of all instance fields declared in the class and its base classes, and an implicit conversion (§13.1.4) exists from a derived class type to any of its base class types. 13 Thus, a reference to an instance of some derived class can be treated as a reference to an instance of any of its base classes.
- 14 A class can declare virtual methods, properties, and indexers, and derived classes can override the implementation of these function members. 15 This enables classes to exhibit polymorphic behavior wherein the actions performed by a function member invocation varies depending on the run-time type of the instance through which that function member is invoked.
|Jagger Software Ltd|
|Company # 4070126|
|VAT # 762 5213 42|