Cor - un sistema OOP alternativo per Perl

Vedere il collegamento per un confronto tra Cor e Moose. Codice d'esempio:

punto di classe {
has ($x, $y) :reader :writer :new :isa(Int);

metodo cancella() {
($x, $y) = (0, 0);
}
}

classe Punto3D Γ¨ Punto {
ha $z :reader :writer :new :isa(Int);

metodo cancella() {
$self->successivo::metodo;
$z = 0;
}
}

Fonte: linux.org.ru

Aggiungi un commento