X hits on this document

876 views

0 shares

0 downloads

0 comments

69 / 396

C# LANGUAGE SPECIFICATION

class A { void F() { int i = 0; if (true) { int i = 1; } }

void G() { if (true) { int i = 0; } int i = 1; }

void H() { if (true) { int i = 0; } if (true) { int i = 1; } }

void I() { for (int i = 0; i < 10; i++) H(); for (int i = 0; i < 10; i++) H(); } }

3.4 Members

Namespaces and types have members. The members of an entity are generally available through the use of a qualified name that starts with a reference to the entity, followed by a “.” token, followed by the name of the member.

Members of a type are either declared in the type or inherited from the base class of the type. When a type inherits from a base class, all members of the base class, except instance constructors, destructors and static constructors, become members of the derived type. The declared accessibility of a base class member does not control whether the member is inherited—inheritance extends to any member that isn’t an instance constructor, static constructor, or destructor. However, an inherited member may not be accessible in a derived type, either because of its declared accessibility (§‎3.5.1) or because it is hidden by a declaration in the type itself (§‎3.7.1.2).

3.4.1 Namespace members

Namespaces and types that have no enclosing namespace are members of the global namespace. This corresponds directly to the names declared in the global declaration space.

Namespaces and types declared within a namespace are members of that namespace. This corresponds directly to the names declared in the declaration space of the namespace.

Namespaces have no access restrictions. It is not possible to declare private, protected, or internal namespaces, and namespace names are always publicly accessible.

3.4.2 Struct members

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

Document info
Document views876
Page views876
Page last viewedMon Dec 05 21:09:37 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments