Delegates: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 70: | Line 70: | ||
delegate implementation |
delegate implementation |
||
</pre> |
</pre> |
||
=={{header|Aime}}== |
|||
<lang aime>text |
|||
thing(void) |
|||
{ |
|||
return "delegate implementation"; |
|||
} |
|||
text |
|||
operation(record delegator) |
|||
{ |
|||
text s; |
|||
if (r_key(delegator, "delegate")) { |
|||
if (r_key(r_query(delegator, "delegate"), "thing")) { |
|||
s = __text(call(r_query(r_query(delegator, "delegate"), "thing"))); |
|||
} else { |
|||
s = "default implementation"; |
|||
} |
|||
} else { |
|||
s = "default implementation"; |
|||
} |
|||
return s; |
|||
} |
|||
integer |
|||
main(void) |
|||
{ |
|||
record delegate, delegator; |
|||
o_text(operation(delegator)); |
|||
o_byte('\n'); |
|||
r_link(delegator, "delegate", delegate); |
|||
o_text(operation(delegator)); |
|||
o_byte('\n'); |
|||
r_put(delegate, "thing", thing); |
|||
o_text(operation(delegator)); |
|||
o_byte('\n'); |
|||
return 0; |
|||
}</lang> |
|||
=={{header|Aikido}}== |
=={{header|Aikido}}== |