J
jheled
Staring with g++ 3.4, this code results in an error
----------------------------------
struct A {
};
class B : private A {
};
class C : public B {
C(A& a);
};
---------------------------------
b.cc:2: error: `struct A' is inaccessible
b.cc:9: error: within this context
This looks wrong to me. You can't access B as an A, but why C can't use
the public A independently? what do other
compliers say?
(Think of the plausible usage
============
struct A {
};
class B : private A {
public:
B(A&) {}
};
class C : public B {
C(A& a) : B(a) {}
};
============
)
Can someone explain this?
Thanks, Joseph
----------------------------------
struct A {
};
class B : private A {
};
class C : public B {
C(A& a);
};
---------------------------------
b.cc:2: error: `struct A' is inaccessible
b.cc:9: error: within this context
This looks wrong to me. You can't access B as an A, but why C can't use
the public A independently? what do other
compliers say?
(Think of the plausible usage
============
struct A {
};
class B : private A {
public:
B(A&) {}
};
class C : public B {
C(A& a) : B(a) {}
};
============
)
Can someone explain this?
Thanks, Joseph