Commit | Line | Data |
---|---|---|
7d44d2b1 | 1 | package Point; |
2 | use Moose; # automatically turns on strict and warnings | |
3 | ||
4 | has 'x' => (is => 'rw', isa => 'Int'); | |
5 | has 'y' => (is => 'rw', isa => 'Int'); | |
6 | ||
7 | sub clear { | |
8 | my $self = shift; | |
9 | $self->x(0); | |
10 | $self->y(0); | |
11 | } | |
12 | ||
13 | package Point3D; | |
14 | use Moose; | |
15 | ||
16 | extends 'Point'; | |
17 | ||
18 | has 'z' => (is => 'rw', isa => 'Int'); | |
19 | ||
20 | after 'clear' => sub { | |
21 | my $self = shift; | |
22 | $self->z(0); | |
23 | }; |