#include <iostream> #include <utility> usingnamespace std; class A{ private: int data;//data int *pi;//point to data public: //禁止隐式转换 A(){ data = 0; pi = &data; } ~A(){ data = -999999; pi = nullptr; }
explicit A(int i) :data(i){ cout << "normal constuctor!" << endl; pi = &data; } A(const A &a){ data = a.data; cout << "copy constructor!" << endl; pi = &data; }