multiple inheritance abiguity
Rich Johnson
rjohnson@dogstar-interactive.com
Fri Jan 20 03:02:00 GMT 2006
On Jan 19, 2006, at 9:49 AM, John Love-Jensen wrote:
> 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.]
My frustration is that whatever ambiguity exists is _manufactured_ by
the compiler. There exists only a a single void f(double)--there is
no global ambiguity.
> 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
> error.
>
> Silently selecting one of the two methods could cause unexpected
> behavior.
I wouldn't mind an info or warning message. Sure it'd be annoying,
but action could be deferred to deal with more pressing issues.
Leave the errors to truly ambiguous cases.
> The solution is to explicitly provide one-or-both methods in the
> derived
> class which forwards to the respective parents' method.
Kinda blows apart the whole concept of public inheritance, doesn't it?
More information about the Gcc-help
mailing list