Restricting super calls to inherited method
Bob Arning
arning at charm.net
Sat May 19 22:13:46 UTC 2001
On Sat, 19 May 2001 14:10:38 -0700 "Andrew P. Black" <black at cse.ogi.edu> wrote:
>It is ALWAYS possible to avoid super calls ENTIRELY. The example that sends
>
> self basicNew
>
>rather than
>
> super new
>
>illustrates the technique. If you would like to call super foo, just
>add a new method to the superclass, say basicFoo, with body "self
>foo". Then the subclass can call self basicFoo.
Andrew,
If I am reading this right, it doesn't work and, likely, never did.
Cheers,
Bob
'From Squeak2.8 of 13 June 2000 [latest update: #2360] on 19 May 2001 at 6:11:11 pm'!
"Change Set: superTest
Date: 19 May 2001
Author: Bob Arning
open a transcript and evaluate
MySub new test
"!
Object subclass: #MySuper
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Objects'!
MySuper subclass: #MySub
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Objects'!
!MySuper methodsFor: 'as yet unclassified' stamp: 'RAA 5/19/2001 18:09'!
basicFoo
Transcript show: 'MySuper>>basicFoo'; cr.
self foo.! !
!MySuper methodsFor: 'as yet unclassified' stamp: 'RAA 5/19/2001 18:09'!
foo
Transcript show: 'MySuper>>foo'; cr.! !
!MySub methodsFor: 'as yet unclassified' stamp: 'RAA 5/19/2001 18:09'!
foo
Transcript show: 'MySub>>foo'; cr.! !
!MySub methodsFor: 'as yet unclassified' stamp: 'RAA 5/19/2001 18:10'!
test
"
MySub new test
"
Transcript show: 'MySub>>test'; cr.
self basicFoo.
! !
More information about the Squeak-dev
mailing list
|