、、待补充
#include<iostream> using std::cout;using std::endl;class Point{public: // constructor Point(int ix,int iy) :_Ix(ix) ,_Iy(iy){ cout<<"Point"<<endl; } // copy constructor Point() Point(const Point & rhs) :_Ix(rhs._Ix) ,_Iy(rhs._Iy){ cout<<"Point (const Point &) copy constructor"<<endl; } void PRint(){ cout<<"("<<this->_Ix <<","<<this->_Iy <<")"<<endl; }private: int _Ix=0; int _Iy=0;};int main(){ Point pt(1,3); pt.print(); Point pt2=pt; // call copy constructor pt2.print(); return 0;}新闻热点
疑难解答