Skip to content

Instantly share code, notes, and snippets.

@Bojne
Created April 26, 2018 15:03
Show Gist options
  • Save Bojne/2f445bd512b53ffb3df14bb21611650f to your computer and use it in GitHub Desktop.
Save Bojne/2f445bd512b53ffb3df14bb21611650f to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
class Instructor{
public:
Instructor();
Instructor(string faculty, string title, string name, char gendar);
string getName();
void getFaculty();
private:
string faculty;
string title;
string name;
char gender; //f:female, m:male
};
class Lecturer: public Instructor{
public:
Lecturer();
Lecturer(string _email, string _background, string _lectures, int _office, int _extension);
void getContact();
//void intro();
private:
string email;
string background;
string lectures;
int office;
int extension;
//string petPhrase;
//office hour + avaliable time
};
class OralPresenter: public Lecturer{
public:
OralPresenter();
OralPresenter(int _classroom, int _talkLength,int _talkLevel,string _talkTopic);
void talkInfo();
void about();
private:
int classroom;
int talkLength;
int talkLevel;
string talkTopic;
// talk speed
// bool easy_to_understand
};
int main(){
Instructor smchang = Instructor("AM", "professor", "SM change", 'f');
smchang.getFaculty();
smchang.getName();
Lecturer yjlee = Lecturer("yjlee@nctu.edu.tw", "Ph.D. in __ uni", "ML101", 208, 33456);
yjlee.getContact();
OralPresenter jjong = OralPresenter(321, 50, 1, "Linear Algebra and it's application");
jjong.getFaculty();
jjong.talkInfo();
return 0;
}
Instructor::Instructor(){
faculty = "Unknown";
title = "Unknown";
name = "Unknown";
gender = 'x';
}
Instructor::Instructor(string _faculty, string _title, string _name, char _gender){
faculty = _faculty;
title = _title;
name = _name;
gender = _gender;
};
string Instructor::getName(){
return (name);
};
void Instructor::getFaculty(){
cout << "Faculty is " <<faculty << endl;
}
Lecturer::Lecturer(){
email = "Unknown";
background = "Unknown";
lectures = "Unknown";
//string petPhrase;
office = 0;
extension = 0;
}
Lecturer::Lecturer(string _email, string _background, string _lectures, int _office, int _extension){
email = _email;
background = _background;
lectures = _lectures;
office = _office;
extension = _extension;
};
void Lecturer::getContact(){
cout << "Contact:" << endl; //cout names!
cout << "- Email: " << email << endl;
cout << "- Phone: 03-5752121(ext. " << extension << ")" << endl;
}
OralPresenter::OralPresenter(){
classroom = 0;
talkLength = 0;
talkLevel = 0;
talkTopic = "Unknown";
}
OralPresenter::OralPresenter(int _classroom, int _talkLength,int _talkLevel, string _talkTopic){
Instructor("AM", "professor", "Jung Jong", 'f');
classroom = _classroom;
talkLength = _talkLength;
talkLevel = _talkLevel;
talkTopic = _talkTopic;
}
void OralPresenter::about(){
getName();
};
void OralPresenter::talkInfo(){
string _name = getName();
cout << _name << endl;
cout << "Talk info: " << endl << "<" << talkTopic << ">, at " << classroom << " ,the talk is " << talkLength << "minutes long." << endl;
cout << "level is " << talkLevel << endl;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment