print Horse->name, "\n"; # prints "an unnamed Horse\n"
my $tv_horse = Horse->named("Mr. Ed");
print $tv_horse->name, "\n"; # prints "Mr Ed.\n"
and now you'll fix speak to use
this:
sub speak {
my $either = shift;
print $either->name, " goes ", $either->sound, "\n";
}
Since sound already worked with either a class or
an instance, you're done!
 |  |  |
9.5. Inheriting the Constructor |  | 9.7. Adding Parameters to a Method |