Home > Back-end >  There no matching function for the call to 'the Teacher: : the Teacher ()' how to solve
There no matching function for the call to 'the Teacher: : the Teacher ()' how to solve

Time:09-17

 # include 
# include
Using namespace STD.

The class Faculty
{
Protected:
Char Name [20].
Int EID.
Int Glade.
Int Salary;
Public:
Virtual void ShowFacultyDetail () {}
Virtual void Position_Change () {}
Virtual int IncreaseSalary (int Salary_Up) {}
Int IncreaseGlade (int Glade_Up)
{
Glade +=Glade_Up;
}
};
The class the Teacher: virtual public Faculty
{
Protected:
Char School [20].
Char Discipline [20].
Public:
The Teacher (char TName [], int TEID, int TGlade, int TSalary, char TSchool [], char TDiscipline [])
{
Strcpy (Name, TName);
Glade=TGlade;
Salary=TSalary;
Strcpy (School, TSchool);
Strcpy (Discipline, TDiscipline);
}
Virtual void ShowFacultyDetail ()
{
Cout<& lt;" The Name "& lt; Cout<& lt;" Glade ";
Cout}
Virtual int IncreaseSalary (int Salary_Up)
{
Salary +=300 * Salary_Up;
}
};
The class Official: virtual public Faculty
{
Protected:
Char Department [20].
Char Position [20].
Int Official_Glade;
Public:
Official (char OName [], int OEID, int OGlade, int OSalary, char ODepartment [], char OPosition [])
{
Strcpy (Name, OName);
EID=OEID;
Glade=OGlade;
Salary=OSalary;
Strcpy (Department, ODepartment);
Strcpy (Position, OPosition);
ShowFacultyDetail ();
}
Virtual void ShowFacultyDetail ()
{
Cout<& lt;" The Name "& lt; Cout<& lt;" Glade ";
Cout}
};
The class Giant: public the Teacher, the public Official
{
Public:
Giant (char GName [], int GEID, int Glade1, int Glade2, int GSalary, char GSchool [], char GDiscipline [], char GDepartment [], char GPosition [])
{
Strcpy (Name, GName);
EID=GEID;
Teacher_Glade=Glade1;
Official_Glade=Glade2;
Salary=GSalary;
Strcpy (School, GSchool);
Strcpy (Discipline, GDiscipline);
Strcpy (Department, GDepartment);
Strcpy (Position, GPosition);
Glade=Teacher_Glade + Official_Glade;
Salary +=Teacher_Glade * 300 + Official_Glade * 3000;
}
Void ShowFacultyDetail ()
{
Cout<& lt;" The Name "& lt; Cout<& lt;" The teacher 's Glade "& lt;
}
Private:
Int Teacher_Glade;
Int Official_Glade;
};
Void fn (Faculty & amp; A, int Salary_Up)
{
Anderson ncreaseGlade (Salary_Up);
A.S howFacultyDetail ();
}
Int main (void)
{
The Teacher A (" ZhaoHong ", 001,1,3000, "Beijing jiaotong university", "communication");
A.S howFacultyDetail ();
Official B (" HuangTaiyan ", 002,1,4000, "office level", "the guidance director");
B.S howFacultyDetail ();
Giant C (" WangJiaQiong ", 003,1,1,6000, "Beijing jiaotong university", "electronic" and "secondary" office, "vice President");
Fn (A, 1);
return 0;
}

CodePudding user response:

Techer no default constructor

CodePudding user response:

Constructor before called when creating an object, call the parent class, subclass again, then the parent class the teacher you don't have a default constructor
  • Related