Compiler Warning (level 3, off) C4265
'classname': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
When a class has virtual functions but a nonvirtual destructor, objects of the type might not be destroyed properly when the class is destroyed through a base class pointer.
This warning is off by default. For more information, see Compiler Warnings That Are Off by Default.
The following sample generates C4265:
// C4265.cpp
// compile with: /W3 /c
#pragma warning(default : 4265)
class B
{
public:
virtual void vmf();
~B();
// try the following line instead
// virtual ~B();
}; // C4265
int main()
{
B b;
}
Tilbakemeldinger
https://aka.ms/ContentUserFeedback.
Kommer snart: Gjennom 2024 faser vi ut GitHub Issues som tilbakemeldingsmekanisme for innhold, og erstatter det med et nytt system for tilbakemeldinger. Hvis du vil ha mer informasjon, kan du se:Send inn og vis tilbakemelding for