📄 person.cpp
字号:
#include <iostream>
#include <string>
#include "Person.h"
using namespace std;
//Person类
Person::Person(string &name,int &age, string &birthday, string &tel)
{
m_Name = name;
m_Age = age;
m_Birthday = birthday;
m_Tel = tel;
l_Child = NULL;
r_Child = NULL;
Father = NULL; //父节点
}
void Person::print()
{
cout<<"姓名: "<<m_Name<<endl;
cout<<"年龄: "<<m_Age<<endl;
cout<<"生日: "<<m_Birthday<<endl;
cout<<"电话: "<<m_Tel<<endl;
}
//Student类
void Student::print()
{
Person::print( );
cout<<"学号: "<<m_Studentnum<<endl;
cout<<"学分: "<<m_Score<<endl;
}
//Faculty类
void Faculty::print()
{
Person::print();
cout<<"职工号: "<<m_Facultynum<<endl;
cout<<"工资: "<<m_Salary<<endl;
}
//Teacher类
void Teacher::print()
{
Faculty::print( );
cout<<"院系号: "<<m_Deptnum<<endl;
}
//Staff类
void Staff::print()
{
Faculty::print();
cout<<"部门号: "<<m_Comment<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -