#include <iostream>
using namespace std;
#include <cstring>
class Student{
public:
Student(int,char[],char,float);
int get_num()
{
return num;
}
char * get_name()
{
return name;
}
char get_sex()
{
return sex;
}
void display()
{
cout<<"num="<<num<<endl;
cout<<"name="<<name<<endl;
cout<<"sex="<<sex<<endl;
cout<<"score="<<score<<endl;
}
private:
int num;
char name[20];
char sex;
float score;
};
Student::Student(int n,char nam[],char s,float so)
{
num=n;
strcpy(name,nam);
sex=s;
score=so;
}
class Teacher{
public:
Teacher(){}
Teacher(Student &stud)
{
num=stud.get_num();
strcpy(name,stud.get_name());
sex=stud.get_sex();
pay=3000;
}
Teacher(int n,char nam[],char s,float p)
{
num=n;
strcpy(name,nam);
sex=s;
pay=p;
}
void display()
{
cout<<"num="<<num<<endl;
cout<<"name="<<name<<endl;
cout<<"sex="<<sex<<endl;
cout<<"pay="<<pay<<endl;
}
private:
int num;
char name[20];
char sex;
float pay;
};
//Teacher::Teacher(int n,char nam[],char s,float p){ num=n; strcpy(name,nam); sex=s; pay=p;}
//Teacher::Teacher(Student &stud){num=stud.get_num();strcpy(name,stud.get_name());sex=stud.get_sex();pay=3000;}
int main()
{
Teacher t1;
Student s1(1,"xian",'F',100);
cout<<"s1:"<<endl;
s1.display();
t1=Teacher(s1);
cout<<"t1:"<<endl;
t1.display();
return 0;
}