[DGD] unequal prototypes driving me crazy
Felix A. Croes
felix at dworkin.nl
Thu Sep 2 14:36:16 CEST 2010
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.
Regards,
Felix Croes
More information about the DGD
mailing list