Information Technology Reference
In-Depth Information
Class Members
The previous two chapters covered two of the nine types of class members: fields and methods.
In this chapter, I will introduce more class member types, and discuss the lifetimes of class
members.
Table 6-1 shows a list of the class member types. Those that have already been introduced
are marked with diamonds. Those that will be covered in this chapter are marked with a check.
Those that will be covered later in the text are marked with empty check boxes.
Table 6-1. Types of Class Members
Data Members
(Store Data)
Function Members
(Execute Code)
Fields
Methods
Operators
Constants
Properties
Indexers
Constructors
Events
Finalizers
Order of Member Modifiers
Previously, you saw that the declarations of fields and methods can include modifiers such as
public and private . In this chapter, I will discuss a number of additional modifiers. Since many
of these modifiers can be used together, the question that arises is: what order do they need to
be in?
Class member declaration statements consist of the following: the core declaration, an
optional set of modifiers , and an optional set of attributes . The syntax used to describe this
structure is the following:
[ attributes ] [ modifiers ] CoreDeclaration
The modifiers, if any, must be placed before the core declaration.
￿
The attributes, if any, must be placed before the modifiers and core declaration.
￿
The square brackets indicate that the set of components inside them is optional.
Search WWH ::




Custom Search