class CFather { public: CFather(){} ~CFather() {printf("0\n");} public: void operator delete(void *p, size_t size) {free(p); printf("1\n");} public: int value; }; class CChild : public CFather { public: CChild(){} ~CChild(){printf("2\n");} public: int value0; int value1; public: void operator delete(void *p, size_t size){printf("3\n"); free(p);} }; int _tmain(int argc, _TCHAR* argv[]) { CChild *pChild = new CChild; CFather *pTem = pChild; delete pTem; return 0; }
如上代码,为什么输出的是0 1而不是 2 3
解决方案
10
帮结帖
5
看来题主积分很多呀!
5
接分
5
看在本人也经常这么2的份上,分点分?