initonly (C++/CLI)
initonly est un mot clé contextuel qui indique cette assignation de variable peut se produire dans le cadre de la déclaration ou dans un constructeur static dans la même classe.
L'exemple suivant montre comment utiliser initionly :
// mcpp_initonly.cpp
// compile with: /clr /c
ref struct Y1 {
initonly
static int staticConst1;
initonly
static int staticConst2 = 0;
static Y1() {
staticConst1 = 0;
}
};