帮忙查看一下 c++ 多重继承 问题
/** practise-9.cpp
*
* Created on: 2010-11-11
* Author: sun
*/
#include <iostream>
using namespace std;
class Teacher
{
public:
Teacher(char nam[], int ag, char se, string add, long num, string tit)
{
strcpy(name, nam);
age = ag;
sex = se;
addr = add;
number = num;
title = tit;
}
void display(void);
private:
char name[10];
int age;
char sex;
string addr;
long number;
string title;
};
class Cadre
{
public:
Cadre(char nam[], int ag, char se, string add, long num, string pos)
{
strcpy(name, nam);
age = ag;
sex = se;
addr = add;
number = num;
post = pos;
}
private:
char name[10];
int age;
char sex;
string addr;
long number;
string post;
};
class Teacher_Cadre : public Teacher, public Cadre
{
public:
Teacher_Cadre(string nam, int ag, char se, string add, long num,string tit, string pos, int wage):
Teacher(string nam, int ag, char se, string add, long num, string tit),
Cadre(string nam, int ag, char se, string add, long num, string pos),wages(wage){} //定义构造函数时报错,错误提示在下面
void show(void);
private:
char name[10];
int age;
char sex;
string addr;
long number;
int wages;
string post;
string title;
};
void Teacher :: display(void)
{
cout << "name=" << name << " age=" << age << "sex=" << sex <<"title=" << title <<
"address=" << addr << "number=" << number << endl;
}
void Teacher_Cadre :: show(void)
{
display();
cout << "post=" << post << "wages=" << wages << endl;
}
int main(void)
{
Teacher_Cadre li("Li", 35, 'm',"chengdu", 8888888, "yuwen", "zhuren", 5000);
li.show();
return 0;
}
以下是Eclipse下编译的错误
..\practise-9.cpp:58: error: expected primary-expression before "char"
..\practise-9.cpp:58: error: expected primary-expression before "int"
..\practise-9.cpp:58: error: expected primary-expression before "char"
..\practise-9.cpp:58: error: expected primary-expression before "add"
..\practise-9.cpp:58: error: expected primary-expression before "long"
..\practise-9.cpp:58: error: expected primary-expression before "tit"
..\practise-9.cpp:59: error: expected primary-expression before "char"
..\practise-9.cpp:59: error: expected primary-expression before "int"
..\practise-9.cpp:59: error: expected primary-expression before "char"
..\practise-9.cpp:59: error: expected primary-expression before "add"
..\practise-9.cpp:59: error: expected primary-expression before "long"
..\practise-9.cpp:59: error: expected primary-expression before "pos"
劳烦 帮忙指出错误原因,该怎么改呢