Delegates: Difference between revisions

Content deleted Content added
Franck (talk | contribs)
Franck (talk | contribs)
Line 1,129: Line 1,129:
Delegator method: initialize { := delegate }
Delegator method: initialize { := delegate }


Delegator method: thing
Delegator method: operation
{
{
@delegate respondTo(#thing) ifTrue: [ @delegate thing return ]
@delegate respondTo(#thing) ifTrue: [ @delegate thing return ]
Line 1,136: Line 1,136:
Usage :
Usage :


<lang Oforth>Delegator new(null) thing
<lang Oforth>Delegator new(null) operation
Default implementation
Default implementation


Delegator new(Delegate1 new) thing
Delegator new(Delegate1 new) operation
Default implementation
Default implementation


Delegator new(Delegate2 new) thing
Delegator new(Delegate2 new) operation
Delegate implementation</lang>
Delegate implementation</lang>