Private Protected - Visual Basic (original) (raw)

The Private Protected keyword combination is a member access modifier. A Private Protected member is accessible by all members in its containing class, as well as by types derived from the containing class, but only if they are found in its containing assembly.

You can specify Private Protected only on members of classes; you cannot apply Private Protected to members of a structure because structures cannot be inherited.

The Private Protected access modifier is supported by Visual Basic 15.5 and later. To use it, you can add the following element to your Visual Basic project (*.vbproj) file. As long as Visual Basic 15.5 or later is installed on your system, it lets you take advantage of all the language features supported by the latest version of the Visual Basic compiler:

<PropertyGroup>
   <LangVersion>latest</LangVersion>
</PropertyGroup>

For more information see setting the Visual Basic language version.

Note

In Visual Studio, selecting F1 help on private protected provides help for either or . The IDE picks the single token under the cursor rather than the compound word.

Rules

Behavior

The Private Protected modifier can be used in these contexts:

See also