g++ - priv
Maciej Hrebien
m_hrebien@poczta.onet.pl
Fri Mar 16 10:29:00 GMT 2001
Hi,
I use gcc-2.95.2 package and I think that there is a little bug. Please look
at this:
#include <iostream>
using std::cout;
class A
{
public:
int x;
void fun(){ cout<<"A::fun"<<endl; }
void foo(){ cout<<"A::foo"<<endl; }
};
class B : public A
{
using A::fun;
using A::x;
public:
void foo(){ cout<<"B::foo"<<endl; }
};
main()
{
B b;
b.foo();
b.A::foo();
b.fun(); // !!!
b.x=0; // !!!
return 0;
}
Lines marked as "!!!" are accessing private member and function and the
compiler
doesn't report errors. But even worst: the code is linked, the program is
working but my private members aren't _private_ :(
Maciej Hrebien
--
More information about the Gcc-bugs
mailing list