Буду благодарен если ещё меню подскажете как сотворить:)
Human.h
#include "Working.h"
#include <iostream>
#include <string>
using namespace std;
class Human {
private:
string name_h;
string last_name_h;
int ege_h;
public:
Human() {}
Human(string name_h, string last_name_h, int ege_h)
{
this->name_h = name_h;
this->last_name_h = last_name_h;
this->ege_h = ege_h;
}
string getname_h() { return this->name_h; }
string getname_last_h() { return this->last_name_h; }
int getege_h() { return this->ege_h; }
void setname_h(string name_h) { this->name_h = name_h; }
void setlast_name_h(string last_name_h) { this->last_name_h = last_name_h; }
void setege_h(int ege_h) { this->ege_h = ege_h; }
friend ostream& operator << (ostream &os, const Human &obj_h)
{
os << obj_h.name_h << endl;
os << obj_h.last_name_h << endl;
os << obj_h.ege_h << endl;
return os;
}
friend istream& operator >> (istream &is, Human &obj_h)
{
cout << "Enter name Humen" << endl;
is >> obj_h.name_h;
cout << "Enter Last Name Humen: " << endl;
is >> obj_h.last_name_h;
cout << "Enter ege Humen; " << endl;
is >> obj_h.ege_h;
return is;
}
};
Student.h
#include <iostream>
#include <string>
#include "Human.h"
using namespace std;
class Student {
private:
Human human;
string name_s;
string last_name_s;
int ege_s;
public:
Student() {}
Student(string name_s, string last_name_s, int ege_s, Human human) {
this->name_s = name_s;
this->last_name_s = last_name_s;
this->ege_s = ege_s;
this->human = human;
}
string getname_s() { return this->name_s; }
string getname_last_s() { return this->last_name_s; }
int getege_s() { return this->ege_s; }
void setname_s(string name_s) { this->name_s = name_s; }
void setlast_name_s(string last_name_s) { this->last_name_s = last_name_s; }
void setege_s(int ege_s) { this->ege_s = ege_s; }
friend ostream& operator<<(ostream &os, const Student &obj_s)
{
os << obj_s.name_s << endl;
os << obj_s.last_name_s << endl;
os << obj_s.ege_s << endl;
return os;
}
friend istream& operator >> (istream &is, Student &obj_s)
{
cout << "Enter Name Student: " << endl;
is >> obj_s.name_s;
cout << "Enter Last Name Student: " << endl;
is >> obj_s.last_name_s;
cout << "Enter ege Student; " << endl;
is >> obj_s.ege_s;
return is;
}
/* operator Human() {
return Human();
} */
};
Working.h
#include <string>
#include "Human.h"
using namespace std;
class Working {
private:
string name_w;
string last_name_w;
int ege_w;
public:
Working() {}
Working(string name_w, string last_name_w, int ege_w)
{
this->name_w = name_w;
this->last_name_w = last_name_w;
this->ege_w = ege_w;
}
string getname_w() { return this->name_w; }
string getname_last_w() { return this->last_name_w; }
int getege_w() { return this->ege_w; }
void setname_w(string name_w) { this->name_w = name_w; }
void setlast_name_w(string last_name_w) { this->last_name_w = last_name_w; }
void setege_w(int ege_w) { this->ege_w = ege_w; }
friend ostream& operator<<(ostream &os, const Working &obj_w)
{
os << obj_w.name_w << endl;
os << obj_w.last_name_w << endl;
os << obj_w.ege_w << endl;
return os;
}
friend istream& operator >> (istream &is, Working &obj_w)
{
cout << "Enter name Working" << endl;
is >> obj_w.name_w;
cout << "Enter Last Name Working: " << endl;
is >> obj_w.last_name_w;
cout << "Enter ege Working; " << endl;
is >> obj_w.ege_w;
return is;
}
};