I don't think this is correct. Try the following:
package Foo; sub new { my $class = shift; print "In Foo with '$class'\n"; return bless {}, $class; } package Bar; @ISA = qw(Foo); sub new { my $class = shift; my $self = $class->SUPER::new; print "In Bar with a self of '$self'\n"; return $self; }
Now, I'm assuming that all classes in this hierarchy are using the two-arg form of bless. If they are, then $class will be passed around and it will be the child class.
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In reply to Re: Re: A few Perl OOP questions.
by dragonchild
in thread A few Perl OOP questions.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |