Compiler Error C3421
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3421.
type' : you cannot call the finalizer for this class as it is either inaccessible or it does not exist
A finalizer is implicitly private, so it cannot be called from outside its enclosing type.
For more information, see Destructors and Finalizers in Visual C++.
The following sample generates C3421.
// C3421.cpp
// compile with: /clr
ref class A {};
ref class B {
!B() {}
public:
~B() {}
};
int main() {
A a;
a.!A(); // C3421
B b;
b.!B(); // C3421
}
Show: