X hits on this document





256 / 396

Chapter ‎18   Unsafe code

Abstract event declarations are only permitted in abstract classes (§‎

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.

An overriding event declaration must specify the exact same accessibility modifiers, type, and name as the overridden event.

An overriding event declaration may include the sealed modifier. Use of this modifier prevents a derived class from further overriding the event. The accessors of a sealed event are also sealed.

It is a compile-time error for an overriding event declaration to include a new modifier.

Except for differences in declaration and invocation syntax, virtual, sealed, override, and abstract accessors behave exactly like virtual, sealed, override and abstract methods. Specifically, the rules described in §‎10.5.3, §‎10.5.4, §‎10.5.5, and §‎10.5.6 apply as if accessors were methods of a corresponding form. Each accessor corresponds to a method with a single value parameter of the event type, a void return type, and the same modifiers as the containing event.

10.8 Indexers

An indexer is a member that enables an object to be indexed in the same way as an array. Indexers are declared using indexer-declarations:

indexer-declaration: attributesopt   indexer-modifiersopt   indexer-declarator   {   accessor-declarations   }

indexer-modifiers: indexer-modifier indexer-modifiers   indexer-modifier

indexer-modifier: new public protected internal private virtual sealed override abstract extern

indexer-declarator: type   this   [   formal-parameter-list   ] type   interface-type   .   this   [   formal-parameter-list   ]

An indexer-declaration may include a set of attributes (§‎17) and a valid combination of the four access modifiers (§‎10.2.3), the new (§‎10.2.2), virtual (§‎10.5.3), override (§‎10.5.4), sealed (§‎10.5.5), abstract (§‎10.5.6), and extern (§‎10.5.7) modifiers.

Indexer declarations are subject to the same rules as method declarations (§‎10.5) with regard to valid combinations of modifiers, with the one exception being that the static modifier is not permitted on an indexer declaration.

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.243

Document info
Document views687
Page views687
Page last viewedThu Oct 27 21:03:40 UTC 2016