Respond to an unknown method call: Difference between revisions
Content added Content deleted
Line 243: | Line 243: | ||
}</lang> |
}</lang> |
||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
Using generic handler (ELENA |
Using generic handler (ELENA 4.x): |
||
<lang elena>import extensions |
<lang elena>import extensions; |
||
class Example |
class Example |
||
{ |
{ |
||
generic |
generic() |
||
{ |
|||
// __received is an built-in variable containing the incoming message name |
|||
console.printLine(__received," was invoked") |
|||
} |
|||
generic(x) |
generic(x) |
||
{ |
|||
console |
console.printLine(__received,"(",x,") was invoked") |
||
} |
|||
generic(x,y) |
generic(x,y) |
||
{ |
|||
console |
console.printLine(__received,"(",x,",",y,") was invoked") |
||
} |
|||
} |
} |
||
public program |
public program() |
||
{ |
|||
[ |
|||
var o := |
var o := new Example(); |
||
o |
o.foo(); |
||
o |
o.bar(1); |
||
o |
o.someMethod(1,2) |
||
}</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |