in reply to Re: Idea on a Base class API
in thread Idea on a Base class API
I should've given an example.
package Foo; use BaseClass; our @ISA = qw(BaseClass); Foo->define_attributes( name => 'STRING', age => 'NUM', weight => 'NUM', ); sub initialize { my $self = shift; $self->SUPER::initialize(@_); my ($name, $age) = $self->get('name', 'age'); print "My name is $name and I am $age years old!\n"; return 1; } 1; _____ package Bar; use Foo; my $person = Foo->new(name => 'Child1', age => 5); $person->set(weight => 40);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re{2}: Idea on a Base class API
by Masem (Monsignor) on Jun 13, 2001 at 01:39 UTC | |
by John M. Dlugosz (Monsignor) on Jun 13, 2001 at 18:44 UTC |