`using base::member;' does not work

Ryszard Kabatek rysio@rumcajs.chemie.uni-halle.de
Sat Sep 19 04:57:00 GMT 1998


The sample comes from the B. Stroustrup's book
"The Design and Evolution of C++".

It does make the B::f member function available
for class D trough the using directive.

The egcs-1.1 doesn't compile this sample.
eg++ main.cc
main.cc:15: cannot adjust access to `void B::f(char)' in `class D'
main.cc:13:   because of local method `void D::f(int)' with same name


# include <iostream.h>

class B {
  public:
    void f(char c) {cout << c << '\n';}
};

class D : public B {
  public:
    void f(int c) {cout << c << '\n';}   // line 13
    using B::f;
};

int main()
{
  D d;
  d.f('x');
}

My configuration:
Linux (RedHat 5.1), Pentium II
egcs-1.1


Ryszard Kabatek

Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de




More information about the Gcc mailing list