in reply to Re: A quicker way to have protected and private fields?
in thread A quicker way to have protected and private fields?
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: A quicker way to have protected and private fields?
by chromatic (Archbishop) on Feb 28, 2006 at 20:14 UTC | |
by gargle (Chaplain) on Feb 28, 2006 at 20:24 UTC | |
by gargle (Chaplain) on Feb 28, 2006 at 20:27 UTC |