RosettaCodeData/Task/Call-an-object-method/Phix/call-an-object-method.phix
2026-02-01 16:33:20 -08:00

11 lines
360 B
Text

without js -- (no class in p2js)
class test
string msg = "this is a test"
procedure show() ?this.msg end procedure
procedure inst() ?"this is dynamic" end procedure
end class
test t = new()
t.show() -- prints "this is a test"
t.inst() -- prints "this is dynamic"
t.inst = t.show
t.inst() -- prints "this is a test"