ADD file via upload

main
pe9xjwfro 5 months ago
parent 832dedb83e
commit 9cd957f352

@ -0,0 +1,37 @@
#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
Loading…
Cancel
Save