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;
}
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru