class Temporary_Employee: public Employee{
//consolidated monthly pay
public:
int con_pay;
int sal;
Temporary_Employee(string name,int num,string des,int cp) :Employee(name,num,des){
con_pay=cp;
}
void salary(){
sal=con_pay;
}
void display_t(){
cout<<"Name: "<<employee_name<<endl;
cout<<"Number: "<<employee_no<<endl;
cout<<"Designation: "<<desig<<endl;
cout<<"Monthly Salary: "<<sal<<endl;
}
};
I'm getting error:'Employee::Employee(std::string, int, std::string)' is private within this context
CodePudding user response:
It seems like you need make the data members in you "Employee" class as public. like this
Employee(...){
public:
{data members}
}
CodePudding user response:
The data members (name,num,des) in your 'Employee' class should be specified as public.