initonly (C++/CLI)

initonly 변수 할당을 나타내는 상황에 맞는 키워드 같은 클래스의 정적 생성자 또는 선언의 일부로 서 발생할 수 있습니다.

다음 예제에서는 initionly의 사용 방법을 보여 줍니다.

// mcpp_initonly.cpp
// compile with: /clr /c
ref struct Y1 {
   initonly
   static int staticConst1;

   initonly
   static int staticConst2 = 0;

   static Y1() {
      staticConst1 = 0;
   }
};

참고 항목

참조

클래스 및 구조체(C++ 구성 요소 확장)