This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]