rdww has asked for the wisdom of the Perl Monks concerning the following question:
Any suggestions, would be greatly appreaciated?</>
Thanks Robert Walkup
#!/bin/perl package main; #main use Employee; my $hld = new Employee(); print "my gender is " . $hld->gender() . ".\n"; print "my name is " . $hld->fullname() . ".\n"; exit(0); #Employee - Inherits from Person Class and Gender Class package Employee; use Gender; use Person; @ISA = ("Gender","Person"); 1 #Person Class - just sets full name package Person; use strict 'vars'; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{FULLNAME} = "Robert Walkup"; bless ($self, $class); return $self; } sub fullname { my $self = shift; return $self->{FULLNAME}; } 1 #Gender Class - just sets full gender package Gender; use strict 'vars'; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{GENDER} = "MALE"; bless ($self, $class); print "YEAKS\n"; return $self; } sub gender { my $self = shift; return $self->{GENDER}; } 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how do I do multiple inheritance
by Flame (Deacon) on Jan 25, 2002 at 02:23 UTC | |
|
Re: how do I do multiple inheritance
by lachoy (Parson) on Jan 25, 2002 at 02:57 UTC | |
by Vavoom (Scribe) on Jan 25, 2002 at 03:38 UTC | |
by lachoy (Parson) on Jan 25, 2002 at 08:02 UTC | |
|
(tye)Re: how do I do multiple inheritance
by tye (Sage) on Jan 25, 2002 at 22:42 UTC | |
by herveus (Prior) on Jan 26, 2002 at 01:53 UTC |