首页题目详情

定义一个人员类Cperson,包括数据成员:姓名、编号、性别和用于输入输出的成员函数。在此基础上派生出学生类CStudent(增加成绩)和老师类Cteacher(增加教龄),并实现对学生和教师信息的输入输出。

问答题
2018-12-13 12:36:38
02201
参考答案:#include class Cperson{ protected:  char name[10];  int id;  int sex; public:  virtual void getInfor() = 0;  virtual void printInfor() = 0;};class CStudent:public Cperson{ protected:  int course; public:  virtual void getInfor()  {   using namespace std;   cout << "Enter the student's inforamtion" << endl;   cout << "Enter the name: ";   cin >> name ;   cout << "Enter the id: ";   cin >> id;   cout << "Enter the sex (1 or 0 1.men 0.women): ";   cin >> sex...
查看答案
 参考答案
科目:C++
学科:计算机科学与技术