編譯器錯誤 C3290
'type : trivial 屬性不能有參考類型
屬性宣告不正確。 當您宣告 trivial 屬性時,編譯器會建立屬性將更新的變數,而且類別中不可以有追蹤參考變數。
範例
下列範例會產生 C3290。
// C3290.cpp
// compile with: /clr /c
ref struct R {};
ref struct X {
R^ mr;
property R % y; // C3290
property R ^ x; // OK
// OK
property R% prop {
R% get() {
return *mr;
}
void set(R%) {}
}
};
int main() {
X x;
R% xp = x.prop;
}