Cor - vaihtoehtoinen OOP-järjestelmä Perlille

Katso linkistä Corin ja Mooseen vertailu. Esimerkkikoodi:

luokka Piste {
on ( $x, $y ) :reader :writer :new :isa(Int);

menetelmä clear() {
( $x, $y ) = ( 0, 0 );
}
}

luokka Piste3D isa Piste {
on $z :reader :writer :new :isa(Int);

menetelmä clear() {
$self->next::method;
$z = 0;
}
}

Lähde: linux.org.ru

Lisää kommentti