Sửa access modifier của các biến trong lớp người thành protected.
Anyway, để post được code thì nhớ chừa 1 dòng trống giữa đoạn code và đoạn text
class Ngay
{
private:
int day;
int month;
int year;
public:
Ngay(int d, int m, int y):day(d),month(m),year(y){};
int getDay()
{
return this->day;
}
int getMonth()
{
return this->month;
}
int getYear()
{
return this->year;
}
friend istream &operator>>(istream &input, Ngay &A)
{
input >> A.day >> A.month >> A.year;
return input;
}
friend ostream &operator<<(ostream &output, const Ngay &A)
{
output << A.day << " " << A.month << " " << A.year;
return output;
}
};
class Nguoi
{
protected:
string Ho;
string Ten;
int namSinh;
int gioiTinh;
string Que;
public:
Nguoi(string ho, string ten, int namsinh, int gioitinh, string que)
:Ho(ho),Ten(ten),namSinh(namsinh),gioiTinh(gioitinh),Que(que){};
};
class Dang_vien: public Nguoi
{
private:
int so_the;
Ngay vao_dang;
Ngay vao_dang_ct;
string chuc_vuD;
public:
Dang_vien(string ho, string ten, int namsinh, int gioitinh, string que,
int sothe, Ngay vaodang, Ngay vaodangct, string chucvuD)
:Nguoi(ho, ten, namsinh, gioitinh, que), so_the(sothe),
vao_dang(vaodang), vao_dang_ct(vaodangct), chuc_vuD(chucvuD){};
friend istream &operator>>(istream &input, Dang_vien &A)
{
input >> A.Ho >> A.Ten >> A.namSinh >> A.gioiTinh >> A.Que >> A.so_the >> A.vao_dang >> A.vao_dang_ct;
return input;
}
int getTuoiD()
{
return vao_dang_ct.getYear();
}
};