/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
using namespace std;
class Employee {
protected:
string name;
int number;
public:
Employee() {}
Employee(string name, int number) {
this->name = name;
this->number = number;
}
void getData() {
cout << "Enter Employee Name " << endl;
cin >> this->name;
cout << "Enter Employee Number " << endl;
cin >> this->number;
}
void putData() {
cout << "Employee Name: " << this->name << ", Employee Number: " << this->number << endl;
}
};
class Manager : public Employee
{
protected:
string title;
public:
Manager() {}
Manager(string name, int number, string title) : Employee(name, number) {
this->title = title;
}
void getData() {
Employee::getData();
cout << "Enter Manager Title " << endl;
cin >> this->title;
}
void putData() {
Employee::putData();
cout << "Manager Title: " << this->title << endl;
}
};
class Scientist : public Employee
{
protected:
int numberOfPublications;
public:
Scientist() {}
Scientist(string name, int number, int numberOfPublications) : Employee(name, number) {
this->numberOfPublications = numberOfPublications;
}
void getData() {
Employee::getData();
cout << "Enter Scientist Number Of Publications " << endl;
cin >> this->numberOfPublications;
}
void putData() {
Employee::putData();
cout << "Scientist Number Of Publications: " << this->numberOfPublications << endl;
}
};
int main() {
// managers
Manager m1;
m1.getData();
m1.putData();
Manager m2("Samir", 1, "CEO");
m2.putData();
// scientists
Scientist s1;
s1.getData();
s1.putData();
Scientist s2("Samir Abboud", 1, 45);
s2.putData();
}