'var' :常值數據成員不能當做 l 值使用
備註
常 值 變數為 const,且其值在宣告中初始化之後便無法變更。
Example
下列範例會產生 C3891:
// C3891.cpp
// compile with: /clr
ref struct Y1 {
literal int staticConst = 9;
};
int main() {
Y1::staticConst = 0; // C3891
}
'var' :常值數據成員不能當做 l 值使用
常 值 變數為 const,且其值在宣告中初始化之後便無法變更。
下列範例會產生 C3891:
// C3891.cpp
// compile with: /clr
ref struct Y1 {
literal int staticConst = 9;
};
int main() {
Y1::staticConst = 0; // C3891
}