Delegates: Difference between revisions

Content added Content deleted
Line 2,425: Line 2,425:
{{works with|Smalltalk/X}}
{{works with|Smalltalk/X}}
Definition of the thingy:
Definition of the thingy:
<lang smalltalk>
<lang smalltalk>Object
Object
subclass:#Thingy
subclass:#Thingy
instanceVariableNames:''
instanceVariableNames:''
Line 2,433: Line 2,432:
^ 'thingy implementation'</lang>
^ 'thingy implementation'</lang>
Definition of the delegator:
Definition of the delegator:
<lang smalltalk>
<lang smalltalk>Object
Object
subclass:#Delegator
subclass:#Delegator
instanceVariableNames:'delegate'
instanceVariableNames:'delegate'
Line 2,446: Line 2,444:
ifNotUnderstood:'default implementation'.</lang>
ifNotUnderstood:'default implementation'.</lang>
Sample use:
Sample use:
<lang smalltalk>
<lang smalltalk>|d|
|d|
d := Delegator new.
d := Delegator new.
d operation.
d operation.