Call an object method: Difference between revisions
Content added Content deleted
m (PhixClass) |
(Added Wren) |
||
Line 1,883: | Line 1,883: | ||
What is your name ?</pre> |
What is your name ?</pre> |
||
=={{header|Wren}}== |
|||
Note that it's possible in Wren for instance and static methods in the same class to share the same name. This is because static methods are considered to belong to a separate meta-class. |
|||
<lang ecmascript>class MyClass { |
|||
construct new() {} |
|||
method() { System.print("instance method called") } |
|||
static method() { System.print("static method called") } |
|||
} |
|||
var mc = MyClass.new() |
|||
mc.method() |
|||
MyClass.method()</lang> |
|||
{{out}} |
|||
<pre> |
|||
instance method called |
|||
static method called |
|||
</pre> |
|||
=={{header|XLISP}}== |
=={{header|XLISP}}== |