नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'type' : a reference type which has a destructor cannot be used as the type of static data member 'member'
Remarks
The common language runtime cannot know when to run a user-defined destructor when the class also contains static member function.
A destructor will never be run unless the object is deleted explicitly.
For more information, see,
Example
The following example generates C3162.
// C3162.cpp
// compile with: /clr /c
ref struct A {
~A() { System::Console::WriteLine("in destructor"); }
static A i; // C3162
static A^ a = gcnew A; // OK
};
int main() {
A ^ a = gcnew A;
delete a;
}