नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'var' : l-value use of initonly data member is only allowed in an instance constructor of class 'type_name'
Remarks
Static initonly data members can only have their address taken in a static constructor.
Instance (non-static) initonly data members can only have their address taken in instance (non-static) constructors.
Example
The following example generates C3893:
// C3893.cpp
// compile with: /clr
ref struct Y1 {
Y1() : data_var(0) {
int% i = data_var; // OK
}
initonly int data_var;
};
int main(){
Y1^ y= gcnew Y1;
int% i = y->data_var; // C3893
}