polserver/testsuite/escript/classes/super-diamond.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

43 lines
586 B
Text

/*
Diamond problem:
A
/ \
B C
\ /
D
Currently, super will end up calling A ctor twice. This will be fixed with executor implementations.
*/
class A()
function A( this, a0 )
print( "A" );
endfunction
endclass
class B( A )
function B( this, b0 )
super( b0 );
print( "B" );
endfunction
endclass
class C( A )
function C( this, c0 )
super( c0 );
print( "C" );
endfunction
endclass
class D( B, C )
function D( this, d0 )
super( B::b0:= d0, C::c0:= d0 );
print( "D" );
endfunction
endclass
var obj := D( "foo" );
print( obj );