You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
5 months ago
|
#pragma once
|
||
|
#ifndef UNDERGRADUATE_H
|
||
|
#define UNDERGRADUATE_H
|
||
|
#include <iostream>
|
||
|
#include <string>
|
||
|
#include <cstring>
|
||
|
#include "student.h"
|
||
|
using namespace std;
|
||
|
class UnderGraduate : virtual public Student {
|
||
|
protected:
|
||
|
char major[20];
|
||
|
public:
|
||
|
UnderGraduate();
|
||
|
UnderGraduate(char* sname, char* sid, char* sgender, int y, int m, int d, char* sno, char* sschool, char* sclass, char*
|
||
|
smajor);
|
||
|
~UnderGraduate() {};
|
||
|
void setMajor(char* smajor) { strcpy(major, smajor); }
|
||
|
char* getMajor() { return major; }
|
||
|
virtual void inputData();
|
||
|
virtual void displayDetails();
|
||
|
};
|
||
|
UnderGraduate::UnderGraduate() :Student() {
|
||
|
strcpy(major, "null_Major");
|
||
|
}
|
||
|
UnderGraduate::UnderGraduate(char* sname, char* sid, char* sgender, int y, int m, int d, char* sno, char* sschool, char*
|
||
|
sclass, char* smajor) :Student(sname, sid, sgender, y, m, d, sno, sschool, sclass) {
|
||
|
strcpy(major, smajor);
|
||
|
}
|
||
|
void UnderGraduate::inputData() {
|
||
|
Student::inputData();
|
||
|
cout << "Major: "; cin >> major;
|
||
|
}
|
||
|
void UnderGraduate::displayDetails() {
|
||
|
Student::displayDetails();
|
||
|
cout << "Major: " << major << endl;
|
||
|
}
|
||
|
#endif //UNDERGRADUATE_H
|