一、构造函数分类
普通构造函数,复制(拷贝)构造函数,赋值构造函数,
#includeusing namespace std;class A {public: A() { a = 0; }//普通 A(const A&other) { //复制 this->a = other.a; } A &operator=(const A & other) { //赋值 this->a = other.a; return *this; }A(double convert) { //转换构造函数 this->a = int(convert);}private: int a;};int main(){ A a, b;//调用普通构造函数 A c = b;//调用复制构造函数 c = a;//调用赋值构造函数 A d(c);//调用赋值构造函数double e = 0.1;A f(e); return 0;}