Delegates: Difference between revisions
Content added Content deleted
(added translation template for common lisp) |
(common lisp cleanup) |
||
Line 75: | Line 75: | ||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
{{trans|Python}} |
{{trans|Python}} |
||
In CLOS, methods exist apart from classes, and are specialized based on the types of their arguments. This example defines two classes (delegator and delegate), and a thing generic method which is specialized in three ways: (1) for 'any' argument, providing a default method; (2) for delegators, where thing is recursively applied to the delegator's delegate (if there is one); and (3) for delegates. |
In CLOS, methods exist apart from classes, and are specialized based on the types of their arguments. This example defines two classes (delegator and delegate), and a thing generic method which is specialized in three ways: (1) for 'any' argument, providing a default method; (2) for delegators, where thing is recursively applied to the delegator's delegate (if there is one); and (3) for delegates. |
||