From 7682603259077766103 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,58b61be817def08c X-Google-Attributes: gidf78e5,public From: Srinivas Vobilisetti Subject: Re: this-> required? Date: 1998/05/02 Message-ID: <354A5728.A53BF0F@usa.net>#1/1 X-Deja-AN: 349501511 Approved: Fergus Henderson Content-Transfer-Encoding: 7bit References: <354657D6.C45E924F@xilinx.com> <6i7e4r$liq$1@nnrp1.dejanews.com> X-Original-Date: Fri, 01 May 1998 18:13:45 -0500 Mime-Version: 1.0 X-Authentication-Warning: crchh14.us.nortel.com: news set sender to srinivas-v@usa.net using -f Content-Type: text/plain; charset=us-ascii Organization: Bell Northern Research X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANUqLveEDnX0m9pzZAQHEqAF9FUuoIENSBIRld4+RO6hYqD1rY6Ihpx7F LddP7roeTCPHMVLR8AdLGOYk1pjLWGjc =ykSD Newsgroups: comp.std.c++ asbinn@rstcorp.com wrote: > In article <354657D6.C45E924F@xilinx.com>, > Lou Sanchez-chopitea wrote: > > > template class Base > > { > > public: > > int fBase ( void) { return 1;} > > }; > > > > template class Derived : public Base > > { > > public: > > int f1 ( void) { return fBase();} > > int f2 ( void) { return this->fBase();} > > }; > > > > As far as correctness goes, it looks syntactically and semantically > correct to me. > > A consideration is related to the recent Guru of the Week. When class > Derived is parsed, the parent class Base is not considering during > name look-up [temp.dep 14.6.2 paragrph 3]. This means that if there was a > function > > int fBase(); > > declared before the definition of Derived, then it would be bound to > the use of fBase() in the definition of Derived::f1(). Pretty unintuitive > to me. > > Any comments from committee members on the reasoning behind this? > I am not a committee member. Probable reasoning behind this is that aspecialization of class Base may not have the member you are referring to in the class Derived . Srinivas --- [ 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 ]