Access Modifiers
An access modifier determines which class methods—including methods of other classes—can see and use a member variable or method within a class. Table 18-1 summarizes the Visual Basic 2005 access modifiers .
Table 18-1. Access modifiers
|
Access modifier |
Restrictions |
|---|---|
|
|
No restrictions. Members marked |
|
|
The members in class A which are marked |
|
|
The members in class A which are marked |
|
|
The members in class A which are marked |
|
|
The members in class A which are marked |
Tip
The Protected access modifier is used with derived classes, as explained below in the discussion on inheritance. The Friend accessor says that the members are visible to any method within the Assembly. An assembly is a collection of files that appear to the programmer as a single executable (.exe) or DLL.
It is good programming practice to explicitly set the accessibility of all methods and members of your class.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access