|
4 | 4 |
|
5 | 5 | A class is a data structure that may contain data members (constants and fields), function members (methods, properties, events, indexers, operators, instance constructors, finalizers, and static constructors), and nested types. Class types support inheritance, a mechanism whereby a ***derived class*** can extend and specialize a ***base class***. |
6 | 6 |
|
7 | | -Structs (§16) and interfaces (§18) have members similar to classes but with certain restrictions. This clause defines the declarations for classes and class members. The clauses for structs and interfaces define the restrictions for those types in terms of the corresponding declarations in class types. |
| 7 | +Structs ([§16](structs.md#16-structs)) and interfaces ([§18](ranges.md#18-extended-indexing-and-slicing)) have members similar to classes but with certain restrictions. This clause defines the declarations for classes and class members. The clauses for structs and interfaces define the restrictions for those types in terms of the corresponding declarations in class types. |
8 | 8 |
|
9 | 9 | ## 15.2 Class declarations |
10 | 10 |
|
@@ -2052,7 +2052,7 @@ A variable initializer for an instance field cannot reference the instance being |
2052 | 2052 |
|
2053 | 2053 | ### 15.6.1 General |
2054 | 2054 |
|
2055 | | -[§15.6](classes.md#156-methods) and its subclauses cover method declarations in classes. That text is augmented by information about declaring methods in structs ([§16.4](structs.md#164-class-and-struct-differences)) and interfaces ([§19.4.2](interfaces.md#1942-interface-methods)). |
| 2055 | +[§15.6](classes.md#156-methods) and its subclauses cover method declarations in classes. That text is augmented by information about declaring methods in structs ([§16.4](structs.md#164-class-and-struct-differences)) and interfaces ([§19.4.3](interfaces.md#1943-interface-methods)). |
2056 | 2056 |
|
2057 | 2057 | A ***method*** is a member that implements a computation or action that can be performed by an object or class. Methods are declared using *method_declaration*s: |
2058 | 2058 |
|
@@ -2921,7 +2921,7 @@ When an instance method declaration includes an `abstract` modifier, that method |
2921 | 2921 |
|
2922 | 2922 | An abstract method declaration introduces a new virtual method but does not provide an implementation of that method. Instead, non-abstract derived classes are required to provide their own implementation by overriding that method. The *method_body* of an abstract method simply consists of a semicolon. |
2923 | 2923 |
|
2924 | | -Abstract method declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.2](interfaces.md#1942-interface-methods)). |
| 2924 | +Abstract method declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.3](interfaces.md#1943-interface-methods)). |
2925 | 2925 |
|
2926 | 2926 | > *Example*: In the following code |
2927 | 2927 | > |
@@ -3937,7 +3937,7 @@ An abstract property declaration specifies that the accessors of the property ar |
3937 | 3937 |
|
3938 | 3938 | A property declaration that includes both the `abstract` and `override` modifiers specifies that the property is abstract and overrides a base property. The accessors of such a property are also abstract. |
3939 | 3939 |
|
3940 | | -Abstract property declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.3](interfaces.md#1943-interface-properties)). The accessors of an inherited virtual property can be overridden in a derived class by including a property declaration that specifies an `override` directive. This is known as an ***overriding property declaration***. An overriding property declaration does not declare a new property. Instead, it simply specializes the implementations of the accessors of an existing virtual property. |
| 3940 | +Abstract property declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.4](interfaces.md#1944-interface-properties)). The accessors of an inherited virtual property can be overridden in a derived class by including a property declaration that specifies an `override` directive. This is known as an ***overriding property declaration***. An overriding property declaration does not declare a new property. Instead, it simply specializes the implementations of the accessors of an existing virtual property. |
3941 | 3941 |
|
3942 | 3942 | The override declaration and the overridden base property are required to have the same declared accessibility. In other words, an override declaration shall not change the accessibility of the base property. However, if the overridden base property is protected internal and it is declared in a different assembly than the assembly containing the override declaration then the override declaration’s declared accessibility shall be protected. If the inherited property has only a single accessor (i.e., if the inherited property is read-only or write-only), the overriding property shall include only that accessor. If the inherited property includes both accessors (i.e., if the inherited property is read-write), the overriding property can include either a single accessor or both accessors. There shall be an identity conversion between the type of the overriding and the inherited property. |
3943 | 3943 |
|
@@ -4304,7 +4304,7 @@ An abstract event declaration specifies that the accessors of the event are virt |
4304 | 4304 |
|
4305 | 4305 | An event declaration that includes both the `abstract` and `override` modifiers specifies that the event is abstract and overrides a base event. The accessors of such an event are also abstract. |
4306 | 4306 |
|
4307 | | -Abstract event declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.4](interfaces.md#1944-interface-events)). |
| 4307 | +Abstract event declarations are only permitted in abstract classes ([§15.2.2.2](classes.md#15222-abstract-classes)) and interfaces ([§19.4.5](interfaces.md#1945-interface-events)). |
4308 | 4308 |
|
4309 | 4309 | The accessors of an inherited virtual event can be overridden in a derived class by including an event declaration that specifies an `override` modifier. This is known as an ***overriding event declaration***. An overriding event declaration does not declare a new event. Instead, it simply specializes the implementations of the accessors of an existing virtual event. |
4310 | 4310 |
|
|
0 commit comments