Cor je alternativni OOP sustav za Perl

Pogledajte poveznicu za usporedbu Cora i Moosea. Primjer koda:

klasa Point {
ima ($x, $y) :čitač :pisač :novo :isa(Int);

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

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

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

Izvor: linux.org.ru

Dodajte komentar