polserver/testsuite/escript/classes/method-simple.src

20 lines
395 B
Text
Raw Permalink Normal View History

class Foo()
function Foo( this, name )
this.name := name;
endfunction
function print( this, prefix )
::print( $"{prefix}: {this.name}!" );
endfunction
function set_member( this, param )
this.print( $"succeeded with method_id call {param}" );
return "done";
endfunction
endclass
var obj := Foo( "NAME" );
obj.print( "PREFIX" );
print( obj.set_member( "param" ) );