From 698556305849023266 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,58b61be817def08c X-Google-Attributes: gidf78e5,public From: Alexandre Oliva Subject: Re: this-> required? Date: 1998/04/29 Message-ID: #1/1 X-Deja-AN: 349491153 Approved: stephen.clamage@sun.com (comp.std.c++) References: <354657D6.C45E924F@xilinx.com> X-Emacs: 20.4 "Emerald" XEmacs Lucid without mule Mime-Version: 1.0 (generated by SEMI 1.3.2 - "N.DNr") Originator: clamage@taumet X-NNTP-Posting-Host: zecarneiro.lsd.dcc.unicamp.br X-UID: 0000000001 X-Status: $$$T Content-Type: text/plain; charset=US-ASCII Organization: IC - UNICAMP - Campinas, SP, Brazil Newsgroups: comp.std.c++ Lou Sanchez-chopitea writes: > Is the following snippet of code correct? yes and no. > template class Derived : public Base > int f1 ( void) { return fBase();} > In particular, is the this-> in f1 required? Thanks. Nope, it is not required, but it is advisable. Because Base is a type-dependent base class, its scope is only examined at template-instantiation time. If there were a function or type named ::fBase, the usage of fBase in f1 would use this definition instead of the one in the base class. See [temp.dep]/3 for more details. -- Alexandre Oliva mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org http://www.dcc.unicamp.br/~oliva Universidade Estadual de Campinas, SP, Brasil [ 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 ]