C++ 虚继承

来源:百度知道 编辑:UC知道 时间:2024/06/06 19:06:49
请那位大哥帮忙看下下面这段代码,我不知道这中间的参数传递要怎么写,谢谢!

class Date
{
private:
int year;
int month;
int day;
public:
Date(int year1,int month1,int day1);
};

class People
{
private:
char name[11];//姓名
char number[7]; //编号
char id[16]; //身份证号
char sex[3]; //性别
Date birthday;
public:
People(char myname[11],char mynumber[7],char myid[16],char mysex[3],Date mybirthday);
};

class student:public virtual People
{
private:
char classNo[7]; //班号
public:
student() /*这中间的参数该怎么写*/
{
strcpy(classNo,myclassNo);
cout<<"构造了一个student类对象 ."<<endl;
}
};

class teacher:public virtual People
{
private:
char principalship[11]; //职务
char department[21]; //部门
public:
teacher()/*这中

中间参数是要调用上面的虚基类吗?你的派生类里的public里还准备加什么东西进去?没有的话就不用写了吧。。main函数调用的时候用x.PEOPLE::student::graduate()就可以了吧.
我也是C++新手...不一定对的。。编程试试看吧
我有关于虚函数的ppt..要的话我QQ234061917。。一起研究研究吧要不-v-