A base-access consists of the reserved word base
followed by either a ".
" token and an identifier or an expression-list enclosed in square brackets:
A base-access is used to access base class members that are hidden by similarly named members in the current class or struct. A base-access is permitted only in the block of a constructor, an instance method, or an instance accessor. When base.I
occurs in a class or struct, I
must denote a member of the base class of that class or struct. Likewise, when base[E]
occurs in a class, an applicable indexer must exist in the base class.
At compile-time, base-access expressions of the form base.I
and base[E]
are evaluated exactly as if they were written ((B)this).I
and ((B)this)[E]
, where B
is the base class of the class or struct in which the construct occurs. Thus, base.I
and base[E]
correspond to this.I
and this[E]
, except this
is viewed as an instance of the base class.
When a base-access references a function member (a method, property, or indexer), the function member is considered non-virtual for purposes of function member invocation (§7.4.3). Thus, within an override
of a virtual
function member, a base-access can be used to invoke the inherited implementation of the function member. If the function member referenced by a base-access is abstract, an error occurs.