This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Visibility problems in gcc 2.95.2


Denis Perchine wrote:

> test.cpp:27: no matching function for call to `B::rread (char *&, int
> &)'
> test.cpp:18: candidates are: bool B::rread (C *, char *)
> 
> This is obviously wrong as there is one in the class A.
> 
> class A {
> public:
> A(){};
> ~A(){};
> bool rread(char* packet, int size){};
> };
> 
> class B : public A {
> public:
> B(){};
> ~B(){};
> bool rread(C* hdr, char *data){};
> };
> 

This is not a bug.
It may seem wrong to you, but that's how c++ works.
The declaration of rread in class B hides one in class A.
However, you still may call A's rread by specifying it
explicitly:

b.A::rread( packet, size );

Best regards, 
Artem.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]