This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Template class heritance strange behaviour
- From: John Love-Jensen <eljay at adobe dot com>
- To: rodrigo benenson <rodrigo dot benenson at inria dot fr>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Cc: Séverin Lemaignan <severin dot lemaignan at inria dot fr>
- Date: Wed, 14 Mar 2007 09:21:44 -0500
- Subject: Re: Template class heritance strange behaviour
Hi rodrigob,
> //c = _d; // <<< this line generates error : 'c' was not declared
> in this scope
Yep, that is an error. That line (if uncommented) is bad C++.
> this->c = _d; // this access work fine
Yep, that is correct. That's C++.
> Parent<T2>::c = _d; // this access work fine too
Yep, that is correct. That's C++, too.
In Child, I think you can also use something like:
using Parent<T2>::c;
Google for "Koenig lookup" (two phase lookup) if you want details.
Here's one URL:
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,9
90,00.html
HTH,
--Eljay