l void Input(ifstream& ifs)=0; Р?virtual void Output()=0; Р?virtual void Output(ofstream& ofs)=0; Р?virtual double ing()=0; Р?friend class College;Р};Р Рclass Teacher:virtual public Person Р{Рprotected:Р?int Hours; Рpublic: Р?Teacher() Р?{Р Duty=1; Р Salary=800;Р?}Р Р void Input() Р {Р cout<<"\n编号:"; cin>>num;Р cout<<"\n姓名:"; cin>>Name;Р cout<<"\n教师上学期课时:"; cin>>Hours;Р Salary=ing();Р} Р Рvoid Input(ifstream& ifs)Р{Р?ifs>>num>>Name>>Duty>>Hours>>Salary;Р} Р Рvoid Output()Р{Р?cout<<num<<"\t"<<Name<<"\t"<<Duty<<"\t"<<Hours<<"\t"<<Salary<<"\t"<<endl;Р}Р Рvoid Output(ofstream& ofs)Р{Р?ofs<<num<<"\t"<<Name<<"\t"<<Duty<<"\t"<<Hours<<"\t"<<Salary<<"\t"<<endl;Р}Р Рdouble ing()Р{Р?if(Hours>120)Р return Salary+(Hours-120)*20;Р?elseР return Salary;Р}Р};Р Рclass Assistant:virtual public Person //实验员Р{