其他分享
首页 > 其他分享> > 024:这是什么鬼delete

024:这是什么鬼delete

作者:互联网

 1 #include <iostream> 
 2 using namespace std;
 3 class A 
 4 { 
 5 public:
 6     A() { }
 7 virtual ~A() { cout << "destructor A" << endl; } 
 8 }; 
 9 class B:public A { 
10     public: 
11     ~B() { cout << "destructor B" << endl; } 
12 }; 
13 int main() 
14 { 
15     A * pa; 
16     pa = new B; 
17     delete pa; 
18     return 0;
19 }

 

标签:std,cout,这是,namespace,virtual,024,public,delete
来源: https://www.cnblogs.com/balabalabubalabala/p/16691281.html