Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!agate!garnet.berkeley.edu!fjlim From: fjlim@garnet.berkeley.edu Newsgroups: comp.sys.mac.programmer Subject: Re: OOPS/TCL question Keywords: Beginner,Questions,OOPS,TCL Message-ID: <1989Oct25.052253.15855@agate.berkeley.edu> Date: 25 Oct 89 05:22:53 GMT References: <2849@murtoa.cs.mu.oz.au> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Organization: University of California, Berkeley Lines: 29 In article <2849@murtoa.cs.mu.oz.au> rob@cs.mu.oz.au (Robert Wallen) writes: >Am I missing something or is the 'A::' not necessary in the call to x() because >B has inherited it and thus 'this->x()' will do? Therefore 'x()' will do too. > >struct A : direct { void x(void); }; >struct B : A { void y(void); }; >... >B::y(void) >{ > A::x(); >} > >I know its not necessary because I tried compiling it and it works fine. >Why does the Think Class Library seem to specify these things when it doesnt >need to?? I believe that the only places where such unnecessary specifications occur in the TCL are in initialization methods. For example, CBureaucrat::IBureaucrat(aSupervisor); appears in the CDirector::IDirector() method. CDirector is a subclass of CBureaucrat, so the IBureaucrat() method is inherited and it is unnecessary to explicitly specify the class name. I included the specification as a self-documenting feature which reinforces the concept that the superclass initialization method is being called. It's a matter of personal style, similar to the choice of whether or not to prefix instance variables and methods with "this->". Greg Dow, author of the TCL