Cor - alternativni OOP sistem za Perl

Pogledajte link za poređenje Cora i Moosea. Primjer koda:

klasa Point {
ima ( $x, $y ) :reader :writer :new :isa(Int);

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

class Point3D isa Point {
ima $z :reader :writer :new :isa(Int);

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

izvor: linux.org.ru

Dodajte komentar