Cor - ืžืขืจื›ืช OOP ื—ืœื•ืคื™ืช ืœืคืจืœ

ื”ื™ื›ื ืกื• ืœืงื™ืฉื•ืจ ื›ื“ื™ ืœื”ืฉื•ื•ืช ื‘ื™ืŸ Cor ืœื‘ื™ืŸ Moose. ืงื•ื“ ืœื“ื•ื’ืžื”:

class Point {
ื™ืฉ ( $x, $y ) :reader :writer :new :isa(Int);

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

class Point3D isa Point {
ื™ืฉ $z :reader :writer :new :isa(Int);

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

ืžืงื•ืจ: linux.org.ru

ื”ื•ืกืคืช ืชื’ื•ื‘ื”