#!/perl/bin/perl # 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->{part1} = Person->new( @_ ); #One of the things things that makes up a Monk is a Person $self->{level} = 0; bless $self, $type; } sub promote { my( $self ) = shift; print "Brother ", $self->{person}{name}, " is getting some XP\n"; $self->{level}++; } $monk1 = Monk::new("Monk","Darrel","mypass","Darrel Cusey"); print "Brother ", $monk1->{part1}{name}, " is level ", $monk1->{level},"\n"; promote($monk1); print "Brother ", $monk1->{part1}{name}, " is level ", $monk1->{level},"\n";;