in reply to Composition Examples Sought
package Person; sub new { my $class = shift; my $type = ref($class) || $class; my $self = {}; $self->{name} = shift; $self->{password} = shift; $self->{realname} = shift; bless $self, $type; } package Monk; sub new { my $class = shift; my $type = ref($class) || $class; my $self = {}; $self->{person} = Person->new( @_ ); $self->{level} = 0; bless $self, $type; } sub promote { my( $self ) = shift; print "Brother ", $self->{person}{name}, " is getting some XP\n"; $self->{level}++; } 1;
-derby
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Composition Examples Sought
by meatpopsicl3 (Initiate) on May 24, 2002 at 17:23 UTC | |
by darrel3edndcom (Novice) on Jun 08, 2002 at 01:46 UTC |