From 6971910038002358663
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,58b61be817def08c
X-Google-Attributes: gidf78e5,public
From: Valentin Bonnard <bonnardv@pratique.fr>
Subject: Re: this-> required?
Date: 1998/04/29
Message-ID: <354736E7.41C67EA6@pratique.fr>#1/1
X-Deja-AN: 348754148
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
Content-Transfer-Encoding: 7bit
References: <354657D6.C45E924F@xilinx.com>
X-Original-Date: Wed, 29 Apr 1998 16:19:19 +0200
Content-Type: text/plain; charset=us-ascii
Organization: Ecole Normale Superieure, Paris, France
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANUc40+EDnX0m9pzZAQEi1gF/bLkF3TwiIu0dvSlgEO6jiu4Vv5Zd2E5w e1gKo3vRW5Z2HJjY9YhUKN9qgUL4b3a7 =+7H7
Mime-Version: 1.0
Newsgroups: comp.std.c++


Lou Sanchez-chopitea wrote:

>     Is the following snippet of code correct?

no, f1 isn't valid (but will work with a lot of 
todays compilers)

> template <class T> class Base
> {
> public:
>     int fBase ( void) { return 1;}
> };
> 
> template <class T> class Derived : public Base<T>
> {
> public:
>     int f1 ( void) { return fBase();}
>     int f2 ( void) { return this->fBase();}
> };
> 
>     In particular, is the this-> in f1 required? Thanks.

Yes, because othewise fBase() is a non-dependant name 
bound in the environement of the definition, not of the 
instanciation.

-- 

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/
---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



