That code isn't complete or tested but it should give you some idea of how to go about implementing a factory method.sub Zoo::factory { my($self, $class, $args) = @_; my $obj = "Zoo::Animal::$class"->new( $args ); $self->{"_${class}_count"}++; return $obj; } my $zoo = Zoo->new; my $camel = $zoo->factory("Camel");
_________
broquaint
In reply to Re: Creating Common Constructor
by broquaint
in thread Creating Common Constructor
by DeadPoet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |