Employee e1; Empowered e2; Manager e3; cout « e1.getMonthlySalary(); // output the monthly salary cout « e2.getMonthlySalary(); // call to the same fn as above e1.getEmployeeType(); // output: Employee e2.getEmployeeType(); // output: Empowered (call to different fn) e3.getEmployeeType(); // output: Manager (call to different fn) e3.Employee::getEmployeeType(); // output: Employee (forced call) cout « e1.isIncompetent(); // ERROR, not in base class |