RosettaCodeData/Task/Call-an-object-method/Zkl/call-an-object-method.zkl

12 lines
317 B
Plaintext

class C{var v; fcn f{v}}
C.f() // call function f in class C
C.v=5; c2:=C(); // create new instance of C
println(C.f()," ",c2.f()) //-->5 Void
C.f.isStatic //--> False
class [static] D{var v=123; fcn f{v}}
D.f(); D().f(); // both return 123
D.f.isStatic //-->False
class E{var v; fcn f{}} E.f.isStatic //-->True