[DGD] unequal prototypes driving me crazy

Shentino shentino at gmail.com
Thu Sep 2 15:10:12 CEST 2010


On Thu, Sep 2, 2010 at 5:36 AM, Felix A. Croes <felix at dworkin.nl> wrote:

> Shentino <shentino at gmail.com> wrote:
>
> > I'm writing a status reporter.
> >
> > It inherits both LIB_USER, so it can be connected to, and LIB_WIZTOOL, so
> > that I can access the cmd_status function.  I even inherited them via
> > labels.
> >
> > Since both of them define the message function, I overrode it with my own
> > version.
> >
> > But the compiler is choking before it even gets far enough to notice I've
> > overridden it.
>
> LIB_WIZTOOL doesn't actually define it; it only has a prototype.  When
> you inherit two objects, of which one defines a function, and the other
> has only a prototype, the prototype and the actual function have to match.
>
> Solution: inherit LIB_WIZTOOL from an intermediate object, which defines
>
>    static void message(string str) { } /* override this! */
>
> Let your status reporter inherit the intermediate object.  Of course,
> there is probably more wiztool-related stuff that you could move from
> the status reporter to the intermediate object.
>

Thanks.

So, just to be clear...if two of my inheritees define the same function with
different prototypes, it's still legal to inherit them both as long as I
override it myself?


> Regards,
> Felix Croes
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>



More information about the DGD mailing list