Share via


状況依存のキーワード (C++ コンポーネント拡張)

状況依存のキーワードは 特定のコンテキストでのみ認識される言語要素です。特定のコンテキストの外部で、状況依存のキーワードはユーザー定義のシンボルです。

すべてのランタイム

解説

次の状況依存のキーワードの一覧です:

読みやすさのために、ユーザー定義のシンボルとして状況依存のキーワードの使用を制限することもできます。

Windows ランタイム

解説

この機能のプラットフォーム固有の解説はありません)。

8d7y7wz6.collapse_all(ja-jp,VS.110).gif要件

コンパイラ オプション: /ZW

共通言語ランタイム

解説

この機能のプラットフォーム固有の解説はありません)。

8d7y7wz6.collapse_all(ja-jp,VS.110).gif要件

コンパイラ オプション: /clr

8d7y7wz6.collapse_all(ja-jp,VS.110).gif

次のコード例は、適切なコンテキストで、プロパティ、および変数を定義するに property の状況依存のキーワードが使用できることを示します。

// context_sensitive_keywords.cpp
// compile with: /clr
public ref class C {
   int MyInt;
public:
   C() : MyInt(99) {}

   property int Property_Block {   // context-sensitive keyword
      int get() { return MyInt; }
   }
};

int main() {
   int property = 0;               // variable name
   C ^ MyC = gcnew C();
   property = MyC->Property_Block;
   System::Console::WriteLine(++property);
}

出力

  

参照

概念

ランタイム プラットフォームのコンポーネントの拡張機能