248 ◾ Software Essentials
Example 8.12: Resolving Ambiguity: C++ Multiple Inheritance
class StudentEmployee: public Employee, public Student
{ …
public:
int getAge() {return Student::getAge();}
int getSeniority() {return Employee::getAge();}
};
Compilers do not deal well with ambiguity. In translating HLL source
code to executable code, compilers systematically follow long, complex
sets of rules. When faced with a choice, a compiler must be able to look
up the resolution of that choice. Compilers cannot capriciously determine
the selection of alternatives. Hence, the intent of all code statements must
be clear. When resolving a function call, it must be obvious to the com-
piler which function to invoke. Hence, the class designer of the ...