Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone tell me why the method getName() returns "Shape=HASH(0x81073ec)->getName()"? Thanks Monks!
# Shape.pm package Shape; sub new { my $class = shift; my $self = { COLOR => "clear", LNGTH => "0", WIDTH => "0", NAME => "blank", @_, }; return bless $self, $class; } sub getName { my $self = shift; return $self->{NAME}; } 1; # in lego.pl use Shape; $circle = Shape->new( COLOR => "red", LNGTH => "2", WIDTH => "2", NAME => "barney" ); print "The color of \$circle is: $circle->getName()\n"; exit(0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: learning oo
by cephas (Pilgrim) on Aug 16, 2002 at 14:58 UTC | |
|
Re: learning oo
by Zaxo (Archbishop) on Aug 16, 2002 at 15:13 UTC | |
|
some OO (ahem) references, ;-)
by BorgCopyeditor (Friar) on Aug 16, 2002 at 15:18 UTC | |
by merlyn (Sage) on Aug 16, 2002 at 17:05 UTC |