In class PEmployee class private section. I need to define person_data which is from the person class. I am not sure how calling the constructor works in this type of scenario?
If you change your PEmployee class to rather accept the age as a parameter instead of requesting it from within the class then you could do the following:
1 2 3 4 5 6 7 8 9 10
class PEmployee {
public: PEmployee();
PEmployee(string employee_name, int employee_age, double initial_salary);
void set_salary(double new_salary);
double get_salary() const;
string get_name() const;
private:
Person person_data;
double salary;
};