Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!brahms.udel.edu!gdtltr From: gdtltr@brahms.udel.edu (root@research.bdi.com (Systems Research Supervisor)) Newsgroups: comp.lang.c++ Subject: Re: Use of this in C++ compared to self in Smalltalk Message-ID: <20526@brahms.udel.edu> Date: 17 Apr 91 21:46:02 GMT References: <0094742D.B7B638A0@uno.edu> <1991Apr17.175658.13334@ux1.cso.uiuc.edu> <20525@brahms.udel.edu> Organization: Brain Dead Innovations, Inc. (BDI) Lines: 35 In article <20525@brahms.udel.edu> gdtltr@brahms.udel.edu (root@research.bdi.com (Systems Research Supervisor)) writes: =>In article <1991Apr17.175658.13334@ux1.cso.uiuc.edu> ml27192@uxa.cso.uiuc.edu (Mark Lanett) writes: =>=>jncs@uno.edu writes: =>=> =>=>>Example : can I write : =>=>> int C::foo (...) =>=>> { =>=>> ... =>=>> this.message =>=>> ... =>=>> } =>=> =>=>>where "message" is a virtual function declared in class C. =>=> =>=>Yes, this and self are similar. Note that this is a pointer, so =>=>the usage is this->message (); this is in fact optional: message () =>=>alone will work. => => Unless, of course, you do something stupid like making a local variable =>which is also named "message". Then the "this" reference would be necessary =>to force the scope into the class rather than the member function. => Or just use the scope resolution operator: C::message. Gary Duzan Time Lord Third Regeneration -- gdtltr@brahms.udel.edu _o_ ---------------------- _o_ [|o o|] Two CPU's are better than one; N CPU's would be real nice. [|o o|] |_o_| Disclaimer: I AM Brain Dead Innovations, Inc. |_o_|