|
|
|
|
#pragma once
|
|
|
|
|
#ifndef STUDENT_H
|
|
|
|
|
#define STUDENT_H
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include "person.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
class Student : virtual public Person {
|
|
|
|
|
protected:
|
|
|
|
|
char studentNo[10];
|
|
|
|
|
char schoolName[20];
|
|
|
|
|
char classIn[20];
|
|
|
|
|
public:
|
|
|
|
|
Student();
|
|
|
|
|
Student(char* sname, char* sid, char* sgender, int y, int m, int d, char* sno, char* sschool, char* sclass);
|
|
|
|
|
~Student() {};
|
|
|
|
|
void setStudentNo(char* sno) { strcpy(studentNo, sno); }
|
|
|
|
|
char* getStudentNo() { return studentNo; }
|
|
|
|
|
void setschoolName(char* sschool) { strcpy(schoolName, sschool); }
|
|
|
|
|
char* getschoolName() { return schoolName; }
|
|
|
|
|
void setclassIn(char* sclass) { strcpy(classIn, sclass); }
|
|
|
|
|
char* getclassIn() { return classIn; }
|
|
|
|
|
virtual void inputData();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
virtual void displayDetails(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
Student::Student() :Person() {
|
|
|
|
|
strcpy(studentNo, "001");
|
|
|
|
|
strcpy(schoolName, "null_schoolName");
|
|
|
|
|
strcpy(classIn, "null_classIn");
|
|
|
|
|
}
|
|
|
|
|
Student::Student(char* sname, char* sid, char* sgender, int y, int m, int d, char* sno, char* sschool, char*
|
|
|
|
|
sclass) :Person(sname, sid, sgender, y, m, d) {
|
|
|
|
|
strcpy(studentNo, sno);
|
|
|
|
|
strcpy(studentNo, sno);
|
|
|
|
|
strcpy(classIn, sclass);
|
|
|
|
|
}
|
|
|
|
|
void Student::inputData() {
|
|
|
|
|
Person::inputData();
|
|
|
|
|
cout << "StudentNo: "; cin >> studentNo;
|
|
|
|
|
cout << "school: "; cin >> schoolName;
|
|
|
|
|
cout << "classIn: "; cin >> classIn;
|
|
|
|
|
}
|
|
|
|
|
void Student::displayDetails() {
|
|
|
|
|
Person::displayDetails();
|
|
|
|
|
cout << "studentNo: " << studentNo << endl;
|
|
|
|
|
cout << "schoolName: " << schoolName << endl;
|
|
|
|
|
cout << "classIn: " << classIn << endl;
|
|
|
|
|
}
|
|
|
|
|
#endif //STUDENT_H
|