这个error不知道怎么解决,好像是与虚基类有关的

#include
#include
using namespace std;
class Staff{ //基类Staff类
private:
char name[20],sex[3];
int y,m,d; //年 月 日
long long int number;(){}
Staff(char* na,char* se,int yy,int mm,int dd,long long int num); //名字、性别。出生日期、身份证
void show();
~Staff(){}
};
Staff::Staff(char* na,char* se,int yy,int mm,int dd,long long int num){
strcpy(name,na);
strcpy(sex,se);
y=yy;
m=mm;
d=dd;
number=num;
}
void Staff::show(){
cout<<"姓名:"<<name<<endl;
cout<<"性别:"<<sex<<endl;
cout<<"出生日期:"<<y<<"年"<<m<<"月"<<d<<"日"<<endl;
cout<<"电话:"<<number<<endl;
}
class Teacher:virtual public Staff{ //Teacher类
private:
char postcall[20]; //职称
public:
Teacher(){}
Teacher(char* postc);
void showt(){cout<<"职称:"<<postcall<<endl;}
~Teacher(){}
};
Teacher::Teacher(char* postc){
strcpy(postcall,postc);
}
class Leader:virtual public Staff{ //Leader类
private:
char posttask[20]; //职务
public:
Leader(){}
Leader(char postt);
void showl(){cout<<"职务:"<<posttask<<endl;}
~Leader(){}
};
Leader::Leader(char
postt){
strcpy(posttask,postt);
}
class DbTeacher:public Teacher,public Leader{ //DbTeacher类
private:
int salary;
public:
DbTeacher(){}
DbTeacher(int sal);
void shows(){cout<<"工资:"<<salary<<endl;}
~DbTeacher(){}
};
DbTeacher::DbTeacher(int sal){
salary=sal;
}
int main()
{
Teacher A;
Leader B;
DbTeacher C;
A.Staff("张三","男",2003,6,17,12345678910);
A.Teacher("教师");
A.show();
A.showt();
cout<<endl;
B.Staff("李四","女",2004,9,6,12345678910);
B.Leader("领导");
B.show();
B.showl();
C.Staff("王五","男",2003,6,9,12345678910);
C.Teacher("车间主任");
C.Leader("管理人员");
C.DbTeacher(6666);
C.show();
C.showt();
C.showl();
C.shows();
cout<<endl;
return 0;
}

img

-

解决了语法错误,但这份代码无法实现你想使用继承来复用代码的目的。
你这里语法存在很大的问题。
把你的需求说出来,可以帮你看看。

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstring>

using namespace std;
class Staff { //基类Staff类
private:
    char name[20], sex[3];
    int y, m, d; //年 月 日
    long long int number;
public:
    Staff() {
        strcpy(name, " ");
        strcpy(sex, " ");
        y = 0;
        m = 0;
        d = 0;
        number = 0;
    }
    Staff(char* na, char* se, int yy, int mm, int dd, long long int num); //名字、性别。出生日期、身份证
    void show();
    ~Staff() {}
};
Staff::Staff(char* na, char* se, int yy, int mm, int dd, long long int num) {
    strcpy(name, na);
    strcpy(sex, se);
    y = yy;
    m = mm;
    d = dd;
    number = num;
}
void Staff::show() {
    cout << "姓名:" << name << endl;
    cout << "性别:" << sex << endl;
    cout << "出生日期:" << y << "年" << m << "月" << d << "日" << endl;
    cout << "电话:" << number << endl;
}
class Teacher :virtual public Staff { //Teacher类
private:
    char postcall[20]; //职称
public:
    Teacher() {}
    Teacher(char* postc);
    void showt() { cout << "职称:" << postcall << endl; }
    ~Teacher() {}
};
Teacher::Teacher(char* postc) {
    strcpy(postcall, postc);
}
class Leader :virtual public Staff { //Leader类
private:
    char posttask[20]; //职务
public:
    Leader() {}
    Leader(char* postt);
    void showl() { cout << "职务:" << posttask << endl; }
    ~Leader() {}
};
Leader::Leader(char* postt) {
    strcpy(posttask, postt);
}
class DbTeacher :public Teacher, public Leader { //DbTeacher类
private:
    int salary;
public:
    DbTeacher() {}
    DbTeacher(int sal);
    void shows() { cout << "工资:" << salary << endl; }
    ~DbTeacher() {}
};
DbTeacher::DbTeacher(int sal) {
    salary = sal;
}
int main()
{
    Staff* A = new Staff((char*)"张三", (char*)"男", 2003, 6, 17, 12345678910);
    Teacher B((char*)"教师");
    A->show();
    B.showt();


    cout << endl;
    return 0;
}