use v6; class animal { has $.legs; submethod new($l) {return self.bless(*, :$l)} submethod BUILD(:$l) { legify($l); multi legify(Int $l) {$!legs = $l} multi legify($l) {$!legs = $l.legs} } } class pet is animal { has $.name is rw; submethod new($x) {return self.bless(*)} } my $spider = animal.new(8); say $spider.legs; $spider = pet.new($spider); say $spider.legs;