[openbeos] Re: compiling c++ classes with virtual functions

  • From: Mahmoud Al Gammal <obos@xxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Fri, 02 Jan 2004 13:27:06 +0000

I'm borrowing these words from the BeBook:
"due to the peculiarities of C++, overriding any version of an overloaded 
function hides all versions of the function".
So, in order to access the hidden function you can either explicitly call 
A::function1(x, y, z), or have function1(int, int, int) implemented in class 
B again.

Mahmoud Al Gammal

>Hello,

>i'm compiling several c++ classes and i'm getting warnings about
>functions hidden by others in child classes.

>Class A
>virtual void function1(int, int, int);
>virtual void function1();

>Class B : Class A
>virtual void function1();

>the warning i'm getting says :
>void function1(int, int, int) in class A is hidden by void function1() in
>class B.

>What do you think i can do to avoid this warning ? Renaming the
>function isn't the best mean because this shouldn't happen in my mind.
>Maybe it is a bug of the compiler ?

>-- 
>Best regards,
> Jerome                          mailto:korli@xxxxxxxx


Other related posts: