D
Dave Rahardja
MSVC seems to have a tough time with this program:
struct A
{
struct L
{};
};
struct B: private A::L
{
struct L
{};
};
struct C: public B::L // <-- Error: see below
{
};
int main()
{
C c;
}
---
error C2247: 'A::L' not accessible because 'B' uses 'private' to inherit from
'A::L'
It seems to me that A::L and B::L are completely different classes, and the
fact that B inherits privately from A::L should effectively hide the A::L
interface from B's users.
It also seems that MSVC is the only compiler complaining about this. Both g++
and Metrowerks CodeWarrior accept the code. Is this an MSVC bug, or am I
getting the standard mixed up?
-dr
struct A
{
struct L
{};
};
struct B: private A::L
{
struct L
{};
};
struct C: public B::L // <-- Error: see below
{
};
int main()
{
C c;
}
---
error C2247: 'A::L' not accessible because 'B' uses 'private' to inherit from
'A::L'
It seems to me that A::L and B::L are completely different classes, and the
fact that B inherits privately from A::L should effectively hide the A::L
interface from B's users.
It also seems that MSVC is the only compiler complaining about this. Both g++
and Metrowerks CodeWarrior accept the code. Is this an MSVC bug, or am I
getting the standard mixed up?
-dr