But I can subclass already by doing:
package src::bo::Rubber; use strict; use warnings; use Carp; use src::bo::Duck; use base qw/src::bo::Duck/; use src::bo::CannotFly; use src::bo::CanSqeek; sub new { my $class = shift; my $extends = $class->SUPER::new(@_); $extends->setFlyBehaviour( src::bo::CannotFly->new() ); $extends->setQuackBehaviour( src::bo::CanSqeek->new() ); bless( $extends, $class ); return $extends; }
In the case of this strategy pattern I don't think I would gain much. Maybe you know of other cases?
In reply to Re^2: A quicker way to have protected and private fields?
by gargle
in thread A quicker way to have protected and private fields?
by gargle
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |