第一次使用windows live writer

来源:互联网 发布:淘宝西装 编辑:程序博客网 时间:2024/04/29 07:40

#include <iostream> using namespace std; class A { private: int data; public: A(int d):data(d){} ~A(){cout<<"~A "<<data<<endl;} }; class B { private: const A* a; public: B(int d); ~B(); }; B::B(int d){ *a = A(d); } B::~B() { if(a){ delete a; *(A **)&a = 0; } } int main(void) { B b(2); b.~B(); system("pause"); return 1; }

原创粉丝点击