Topic: Access to private base class?
Author: boukanov@sentef1.fi.uib.no (Igor Boukanov)
Date: 1996/03/15 Raw View
Here the lines from September DWP, 5.2.6.9:
[Example:
class A { virtual void f(); };
class B { virtual void g(); };
class D : public virtual A, private B {};
void g()
{
D d;
B* bp = (B*)&d; // cast needed to break protection
...
Does "cast needed to break protection" mean that in this case it is possible
to get access to the private base class by simple cast expression?
--
Regards, Igor Boukanov (igor.boukanov@fi.uib.no).
---
[ 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 ]
Author: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Date: 1996/03/15 Raw View
boukanov@sentef1.fi.uib.no (Igor Boukanov) writes:
>Here the lines from September DWP, 5.2.6.9:
>
>class D : public virtual A, private B {};
>void g()
>{
> D d;
> B* bp = (B*)&d; // cast needed to break protection
>...
>
>Does "cast needed to break protection" mean that in this case it is possible
>to get access to the private base class by simple cast expression?
Yes.