浅谈C++中的构造函数分类及调用规则
构造函数的分类 这里简单地将C++中的构造函数分一下类,直接看下面的代码表达,说明在注释中: #include using namespace std; class Text { public: Text() // 无参数构造函数 { m_a = 0; m_b = 0; cout << 无参数构造函数 << endl; } Text(int a) // 有参数构造函数 { m_a = a; m_b = 0; cout << 无参数构造函数 << en
下载地址
用户评论