Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C-sharp language specification.2004.pdf
Скачиваний:
14
Добавлен:
23.08.2013
Размер:
2.55 Mб
Скачать

Chapter 10 Basic concepts

1

void H() {

2

if (true) {

3

int i = 0;

4

}

5

if (true) {

6

int i = 1;

7

}

8

}

9

void I() {

10

for (int i = 0; i < 10; i++)

11

H();

12

for (int i = 0; i < 10; i++)

13

H();

14}

15}

16end note]

1710.4 Members

18Namespaces and types have members. [Note: The members of an entity are generally available through the

19use of a qualified name that starts with a reference to the entity, followed by a “.” token, followed by the

20name of the member. end note]

21Members of a type are either declared in the type or inherited from the base class of the type. When a type

22inherits from a base class, all members of the base class, except instance constructors, destructors, and static

23constructors become members of the derived type. The declared accessibility of a base class member does

24not control whether the member is inherited—inheritance extends to any member that isn’t an instance

25constructor, static constructor, or destructor. However, an inherited member might not be accessible in a

26derived type, either because of its declared accessibility (§10.5.1) or because it is hidden by a declaration in

27the type itself (§10.7.1.2).

2810.4.1 Namespace members

29Namespaces and types that have no enclosing namespace are members of the global namespace. This

30corresponds directly to the names declared in the global declaration space.

31Namespaces and types declared within a namespace are members of that namespace. This corresponds

32directly to the names declared in the declaration space of the namespace.

33Namespaces have no access restrictions. It is not possible to declare private, protected, or internal

34namespaces, and namespace names are always publicly accessible.

3510.4.2 Struct members

36The members of a struct are the members declared in the struct and the members inherited from the struct’s

37direct base class System.ValueType and the indirect base class object.

38The members of a simple type are the members of the struct type aliased by the simple type (§11.1.4).

3910.4.3 Enumeration members

40The members of an enumeration are the constants declared in the enumeration and the members inherited

41from the enumeration’s direct base class System.Enum and the indirect base classes System.ValueType

42and object.

4310.4.4 Class members

44The members of a class are the members declared in the class and the members inherited from the base class

45(except for class object which has no base class). The members inherited from the base class include the

46constants, fields, methods, properties, events, indexers, operators, and types of the base class, but not the

47instance constructors, destructors, and static constructors of the base class. Base class members are inherited

48without regard to their accessibility.

87

Соседние файлы в предмете Электротехника