C++中关于no matching function for call to的报错

#include<iostream>#include<string>usingnamespacestd;classstudent{protected:intnumber;... #include <iostream>
#include <string>
using namespace std;
class student
{
protected:
int number;
string name;
float score;
public:
student(int number1,string name1,float score1)
{
number=number1;
name=name1;
score=score1;
}
void print()
{
cout<<"number:"<<number<<endl;
cout<<"name:"<<name<<endl;
cout<<"score:"<<score<<endl;
}
};
class ustudent:public student
{
private:
string major;
student auditor1;
student auditor2;
public:

ustudent(int number1,string name1,float score1,int number2,string name2,float score2,int number3,string name3,float score3,string major1):student(number1,name1,score1),auditor2(number3,name3,score3),auditor1(number2,name2,score2)
{
major=major1;
}
void print()
{
cout<<"正式生是"<<endl;
student::print();
cout<<"major:"<<major<<endl;
}
void print_auditor1()
{
cout<<"旁听生是:"<<endl;
auditor1.print();
}
void print_auditor2()
{
cout<<"旁听生是:"<<endl;
auditor2.print();
}
};
int main ()
{
ustudent b1(211,"张三",2009,111,"李四",8766,112,"王五",6544);
b1.print();
b1.print_auditor1();
b1.print_auditor2();
return 0;
}

报错是 [Error] no matching function for call to 'ustudent::ustudent(int, const char [5], int, int, const char [5], int, int, const char [5], int)'

有大神知道怎么解决吗!求指点!
展开
 我来答
扈怀炜4h
2016-05-11 · TA获得超过6040个赞
知道大有可为答主
回答量:6907
采纳率:67%
帮助的人:1424万
展开全部
ustudent的构造函数的参数个数或类型 与你的定义不同,所以出现这个错误

ustudent b1(211,"张三",2009,111,"李四",8766,112,"王五",6544); 这个需要10个参数,你只给了9个
kent_ghost
2018-02-27 · TA获得超过254个赞
知道小有建树答主
回答量:266
采纳率:98%
帮助的人:86.9万
展开全部
你调用的时候的参数和你的定义不一致啊,不是最后是个string的major吗?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式