multiple inheritance abiguity

John Love-Jensen
Thu Jan 19 14:50:00 GMT 2006

Hi Rich,

The reason why the duplicate names cause ambiguity is based on the principle
of least surprise.  [I'm not sure what the actual name of the principle is
called, this is just my terminology for it.]

Instead of silently selecting one of the two methods (even given, in the
scenario you mentioned, an exact signature match) the compiler bails with an

Silently selecting one of the two methods could cause unexpected behavior.

The solution is to explicitly provide one-or-both methods in the derived
class which forwards to the respective parents' method.


More information about the Gcc-help mailing list