Topic: Some C++ code
Author: "C. Francis Prince" <prince@oyster.ee.iitm.ernet.in>
Date: 1996/12/17 Raw View
Here is a piece of code. This works if i uncommented the "public".
Otherwise it says A::B::C::D not accessible.
If "public" is there compiler says fine. But in that case B and C are also
private. Why didn't compiler complaint ?
Is this feature not standardized ?
#include <iostream.h>
class A {
class B {
class C {
// public :
class D {
} Dobj ;
} Cobj ;
} Bobj ;
} Aobj ;
void main( void )
{
A::B::C::D Myobj ;
}
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Date: 1996/12/18 Raw View
"C. Francis Prince" <prince@oyster.ee.iitm.ernet.in> writes:
> Here is a piece of code. This works if i uncommented the "public".
> Otherwise it says A::B::C::D not accessible.
> If "public" is there compiler says fine. But in that case B and C are also
> private. Why didn't compiler complaint ?
B and C are private. The reason your compiler didn't complain is just
that your compiler is broken. I suggest that you report the bug to
your compiler vendor.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]