I see where I went wrong. I read the above as bless $self, $class instead of bless $self, $breed.
In any case, I still think that if you want this to be a good tutorial on polymorphism, some of the subclasses should override bark. As it is, it doesn't take advantage of polymorphism.
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Re: Re: It's a dog, but what kind? (polymorphism , in Perl OO)
by hardburn
in thread It's a dog, but what kind? (polymorphism , in Perl OO)
by blue_cowdawg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |