Information Technology Reference
In-Depth Information
Regions Accessing a Member
The member access modifiers in a class's declaration specify which other types can and cannot
access which members of the class. For example, the following declaration shows members
declared with the five access levels.
public class MyClass
{
public int MyMember1;
private int MyMember2;
protected int MyMember3;
internal int MyMember4;
protected internal int MyMember5;
...
The access levels are based on two characteristics with regard to the class being declared:
￿
Whether the class is derived from the class being declared
￿
Whether a class is in the same assembly as the class being declared
These two characteristics yield four groups, as illustrated in Figure 7-15. In relation to the
class being declared, another class can be any of the following:
￿
In the same assembly and derived from it (bottom right)
￿
In the same assembly but not derived from it (bottom left)
￿
In a different assembly and derived from it (top right)
￿
In a different assembly and not derived from it (top left)
These characteristics are used to define the five access levels.
Figure 7-15. Areas of accessibility
Search WWH ::




Custom Search