C++面向对象(十二):隐式构造(转换构造)、编译器自动生成的构造函数 文章目录 C++面向对象(十二):隐式构造(转换构造)、编译器自动生成的构造函数 隐式构造(转换构造) 编译器自动生成的构造函数 隐式构造(转换构造) C++中存在隐式构造的现象: 某些情况下,会隐式调用单参数的构造函数 #include <iostream> using namespace std; class Person { int m_age; public: Person () { cout << "Person() - " << this << endl; } Person (int age) :m_age (age) { cout << "Person(int) - " << this << endl; } // 有默认值的,也算单