polserver/testsuite/escript/classes/doc-sample-09.src
Kevin Eady 0fa1b893a0 Update core-changes, break-changes for classes support (#719)
* Format testsuite escript

* Format testsuite pol

* Update docs
Switch "attributes" to "members" to better align with Escript terms.

* Add core-changes, breaking-changes
2024-10-10 18:06:04 +02:00

21 lines
476 B
Text

class Item()
function Item( this, name )
this.description := name;
endfunction
endclass
class Color()
function Color( this, name )
this.color := name;
endfunction
endclass
class RedDagger( Item, Color )
function RedDagger( this )
super( Item::name:= "dagger", Color::name:= "red" ); // Using only `name` would give an ambiguous error!
endfunction
endclass
var item := RedDagger();
print( $"{item.color} {item.description}" ); // Output: red dagger