C++中有无数的坑,但毕竟……
今天就踩到了,也算是基本问题了,记录一下,顺便以后可以考考自己。你也可以猜猜答案,大牛绕行。
0x1 先看这个:
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 class App 5 { 6 public: 7 ~App() 8 { 9 printf("\n~App\n");10 }11 void output()12 {13 printf("A");14 }15 };16 17 class Bpp : public App18 {19 public:20 ~Bpp()21 {22 printf("\n~Bpp\n");23 }24 void output()25 {26 printf("B");27 }28 };29 30 int main(char args[])
31 {32 Bpp* b = new Bpp();33 delete b;34 35 system("pause");36 return 0;37 }


