用C++ 定义一个学生类Student和教师类Teacher7
发布网友
发布时间:2023-10-10 15:33
我来回答
共2个回答
热心网友
时间:2024-12-05 01:26
#include "stdafx.h"
#include "iostream"
using namespace std;
#include "cstring"
class Student
{
public:
string s_name;
string s_no;
string s_speciality;
Student();
~Student();
void ShowInfo() const;
};
class Teacher
{
public:
string t_name;
string t_no;
string t_level;
string course;
int classcount;
Teacher();
~Teacher();
void ShowInfo () const;
};
class TA : public Student, public Teacher
{
TA(string s_name,string s_no,string s_speciality,string t_name,string t_no,string t_level,string course,int classcount):Student(),Teacher(){}
~TA();
void ShowInfo () const;
};
其中构析函数和析构函数,根据自己需要增加
有问题给我EMAIL mangohappy@qq.com
热心网友
时间:2024-12-05 01:27
mangohappy ,高手,去我那里看看那些东西呀,我都不懂````