parent
e9441104d1
commit
e83105c264
@ -0,0 +1,50 @@
|
|||||||
|
#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();//ÊäÈëÊý¾Ý
|
||||||
|
virtual void displayDetails(); //ÏÔʾÊý¾Ý
|
||||||
|
};
|
||||||
|
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
|
Loading…
Reference in new issue