What does 'has virtual method … but non-virtual destructor' warning mean during C++ compilation?
问题 #include <iostream> using namespace std; class CPolygon { protected: int width, height; public: virtual int area () { return (0); } }; class CRectangle: public CPolygon { public: int area () { return (width * height); } }; Has compilation warning Class '[C@1a9e0f7' has virtual method 'area' but non-virtual destructor How to understand this warning and how to improve the code? [EDIT] is this version correct now? (Trying to give answer to elucidate myself with the concept) #include <iostream>