C++ 没有与参数列表匹配的构造函数 实例
参数类型为: (const char [12], Boy *)
#include<iostream>
#include<string>
using namespace std;
class Boy:public Person{};
class Girl:public Person{
Girl(string name, Boy &b){
cout << "Creating a girl named " << name << "." << endl;
}
};
int main()
{
Girl g2("Pretty Goat", &b);
报错:【没有与参数列表匹配的构造函数 实例
参数类型为: (const char [12], Boy *)】
return 0;
}
只复制了代码片段 为什么会报错没有与参数列表匹配的构造函数?