diff --git a/undergraduate.h b/undergraduate.h new file mode 100644 index 0000000..a3cdc85 --- /dev/null +++ b/undergraduate.h @@ -0,0 +1,37 @@ +#pragma once +#ifndef UNDERGRADUATE_H +#define UNDERGRADUATE_H +#include +#include +#include +#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 \ No newline at end of file