プライベート保護 (Visual Basic)Private Protected (Visual Basic)
キーワード組み合わせ Private Protected
はメンバー アクセス修飾子です。The Private Protected
keyword combination is a member access modifier. Private Protected
メンバーは、それを含んでいるクラスのすべてのメンバーと、それを含むクラスから派生した型によってアクセスできますが、それを含んでいるアセンブリ内に存在する場合に限ります。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.
Private Protected
は、クラスのメンバーに対してのみ指定できます。構造体のメンバーに Private Protected
を適用することはできません。構造体を継承することはできません。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.
Private Protected
アクセス修飾子は Visual Basic 15.5 以降でサポートされています。The Private Protected
access modifier is supported by Visual Basic 15.5 and later. これを使用するには、次の要素を Visual Basic プロジェクト (*.vbproj) ファイルに追加します。To use it, you can add the following element to your Visual Basic project (*.vbproj) file. システムに Visual Basic 15.5 以降がインストールされている限り、最新バージョンの Visual Basic コンパイラでサポートされているすべての言語機能を利用できます。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>
詳細については、「Visual Basic 言語バージョンの設定」を参照してください。For more information see setting the Visual Basic language version.
注意
Visual Studio で、private protected
で F1 ヘルプを選択すると、 privateまたはprotectedのヘルプが表示されます。In Visual Studio, selecting F1 help on private protected
provides help for either private or protected. IDE は、複合単語ではなくカーソルの下にある1つのトークンを選択します。The IDE picks the single token under the cursor rather than the compound word.
ルールRules
- 宣言コンテキスト。Declaration Context.
Private Protected
はクラスレベルでのみ使用できます。You can usePrivate Protected
only at the class level. つまり、Protected
要素の宣言コンテキストはクラスである必要があり、ソースファイル、名前空間、インターフェイス、モジュール、構造体、またはプロシージャにすることはできません。This means the declaration context for aProtected
element must be a class, and cannot be a source file, namespace, interface, module, structure, or procedure.
動作Behavior
アクセスレベル。Access Level. クラス内のすべてのコードは、その要素にアクセスできます。All code in a class can access its elements. 基底クラスから派生し、同じアセンブリに含まれるクラスのコードは、基底クラスのすべての
Private Protected
要素にアクセスできます。Code in any class that derives from a base class and is contained in the same assembly can access all thePrivate Protected
elements of the base class. ただし、基底クラスから派生し、別のアセンブリに含まれているクラスのコードは、基底クラスのPrivate Protected
要素にアクセスすることはできません。However, code in any class that derives from a base class and is contained in a different assembly can't access the base classPrivate Protected
elements.アクセス修飾子。Access Modifiers. アクセスレベルを指定するキーワードは、アクセス修飾子と呼ばれます。The keywords that specify access level are called access modifiers. アクセス修飾子の比較については、「 Visual Basic のアクセスレベル」を参照してください。For a comparison of the access modifiers, see Access levels in Visual Basic.
Private Protected
修飾子は、次のコンテキストで使用できます。The Private Protected
modifier can be used in these contexts:
入れ子になったクラスのClass ステートメントClass Statement of a nested class
クラスで入れ子にされたデリゲートのデリゲートステートメントDelegate Statement of a delegate nested in a class
クラスに入れ子になっている列挙型の列挙ステートメントEnum Statement of an enumeration nested in a class
クラスで入れ子にされたインターフェイスのインターフェイスステートメントInterface Statement of an interface nested in a class
クラスで入れ子になった構造体の構造ステートメントStructure Statement of a structure nested in a class
関連項目See also
フィードバック
フィードバックを読み込んでいます...