#include < iostream >
#define TO_VERSION_NEW 1
using namespace std;
class CShape
{
public:
#if TO_VERSION_NEW
virtual ~CShape()
#else
~CShape()
#endif
{
cout << "CShape: :destrutor" << endl;
};
};
class CRectangle : public CShape
{
public:
int W, h;
~CRectangle() { cout << "CRectangle:: destrutor" << endl; }
};
int main()
{
CShape* p = new CRectangle;
delete p;
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-9270.html