This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Overloaded functions in C++ (bug?)
- To: miguel_l at airtel dot net
- Subject: Re: Overloaded functions in C++ (bug?)
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Sun, 12 Mar 2000 08:53:32 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <Pine.LNX.4.10.10003111400120.9820-100000@localhost.localdomain>
> Yes, I know that I could work around by using `A::f()' in the first
> example and `::f()' in the second one. But I'd like to know whether
> current gcc behaviour is according to the standard or this is a genuine
> bug. I've read the FAQ, but I haven't found any reference to this kind
> of problem.
Thanks for your bug report. This is not a bug in g++, but in your
code. It is not mentioned in the FAQ, because it is a basic aspect of
C++; I recommend to read a book on C++. Methods in the derived class
hide methods in the base class. In standard C++, you could write
class B : public A {
public:
using A::f;
void f(int);
void g();
};
which is currently not supported by g++; instead you can write
class B : public A {
public:
void f(){A::f();}
void f(int);
void g();
};
Regards,
Martin