[DGD] function clash weirdness

Felix A. Croes felix at dworkin.nl
Wed Jan 25 17:39:02 CET 2006


Shentino <shentino at gmail.com> wrote:

> Something I find odd is that if you inherit three (or more?) objects,
> they all have to have labels or you get a clash error.
>
> Here's the code:
>
> inherit LIB_USER;
> inherit account API_ACCOUNT; /* my own account manager api */
> inherit user API_USER;
>
> /* ... */
>
> static void create(int clone)
> {
>     if (clone) {
>         ::create();  /* here I get an "ambiguous call to ::create" */
>         account::create();
>         user::create()
>     }
> }
>
> But if I stop inheriting API_ACCOUNT, the error goes away.
>
> What's going on?  Am I doing something stupid?

It seems to be working as intended.  Put a label in the ::create()
call so the compiler can figure out which inherited create function
to call.

Furthermore, if an identically named function is inherited from
two (or more) different objects, that function has to be redeclared
in the inheriting objects.  This only applies to non-private functions,
non-privately inherited.

Regards,
Dworkin



More information about the DGD mailing list