| < back | The example Point & Point3D classes from Apocalypse 12.
class Point {
has $.x;
has $.y is rw;
method clear {
$.x = 0; $.y = 0;
}
}
class Point3D is Point {
has $:z;
method clear {
$:z = 0;
next METHOD;
}
}
Note how the Point class hierarchy is mirrored by an eigenclass heirarchy. These eigenclasses are automatically created, and are where any class methods would be stored. |
![]() |