Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Daniel Solis - Illustrated C# 2010 - 2010.pdf
Скачиваний:
16
Добавлен:
11.06.2015
Размер:
11.23 Mб
Скачать

CHAPTER 3 TYPES, STORAGE, AND VARIABLES

Data Members and Function Members

Some types, such as short, int, and long, are called simple types and can store only a single data item. Other types can store multiple data items. An array, for example, is a type that can store multiple

items of the same type. The individual items are called elements and are referenced by a number, called an index. Chapter 14 describes arrays in detail.

Types of Members

Other types, however, can contain data items of many different types. The individual elements in these types are called members, and, unlike arrays, in which each member is referred to by a number, these members have distinct names.

There are two types of members: data members and function members.

Data members store data that is relevant to the object of the class or to the class as a whole.

Function members execute code. Function members define how the type can act.

For example, Figure 3-3 shows some of the data members and function members of type XYZ. It contains two data members and two function members.

Figure 3-3. Types specify data members and function members.

34

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]