Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!news.maz.net!ins.net!heeg.de!gustav!hmm
From: hmm@gustav (Hans-Martin Mosner)
Subject: Re: usage of "super"
Message-ID: <DKux5q.Gs3@heeg.de>
Sender: uucp@heeg.de
Organization: Georg Heeg Objektorientierte Systeme, Dortmund, FRG
X-Newsreader: TIN [version 1.2 PL2]
References: <Pine.A32.3.91.960107155155.10442A-100000@aix02.zdv.uni-tuebingen.de>
Date: Mon, 8 Jan 1996 10:01:02 GMT
Lines: 32

Gerrit Jackson (zxmme12@aix02.zdv.uni-tuebingen.de) wrote:
: What is the exact meaning of the "super" modifier, what does it cause and 
: what is it used for?

"super" denotes the exact same object as "self", but when you are sending
messages to it, the message lookup is started in the superclass of the class
in which the sending method is defined.
Example:
ClassA defines:
foo
	Transcript show: 'Hello'

ClassB, subclass of ClassA, defines:
foo
	super foo.
	Transcript show: ', World'

When you send message foo to an instance of classB, the transcript shows
'Hello, World'.

Note that this only works when you use "super" directly as the receiver
of a message. You can store "super" in a variable, but when you send a
message to that variable, the "super" effect is gone...

Hans-Martin


--
+--- Hans-Martin Mosner -------- Senior Smalltalk Guru ---+
| These opinions are entirely ficticious.  Any similarity |
| to real opinions is purely coincidental and unintended. |
+--- <hmm@heeg.de> ------ URL:http://www.heeg.de/~hmm/ ---+
