This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37112] nested inherited class can't access protected members of base class
- From: "chris dot fairles at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2008 15:32:20 -0000
- Subject: [Bug c++/37112] nested inherited class can't access protected members of base class
- References: <bug-37112-16594@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from chris dot fairles at gmail dot com 2008-08-13 15:32 -------
You're simply trying to access a protected member variable which is not
allowed. It doesn't matter if you try to access it from a member function of a
sub-object of A; if you have an object of type A, and it has a protected member
var i, you cannot access it directly. If foo() took a type C, or only tried to
access "i" (the protected member var of A from which C inherits) as opposed to
a.i, then it will compile as expected.
HTH,
Chris
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37112