Cor - sistem OOP alternatif untuk Perl

Ikuti pautan untuk membandingkan Cor dan Moose. Kod sampel:

mata kelas {
mempunyai ($x, $y ) :reader :writer :new :isa(Int);

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

kelas Point3D isa Point {
mempunyai $z :reader :writer :new :isa(Int);

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

Sumber: linux.org.ru

Tambah komen