in reply to Point me in the right direction with OO inheritance and static variables
sub new { my $class = shift; my %params = ( name => 'John', surname => 'Doe', ); my %args = (%params, @_); # Overwrite the defaults bless \%args, $class }
To call the constructor of the parent class, use SUPER:
sub new { my $class = shift; my $self = $class->SUPER::new(%args); return $self }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Point me in the right direction with OO inheritance and static variables
by Amblikai (Scribe) on Sep 02, 2014 at 10:11 UTC | |
by choroba (Cardinal) on Sep 02, 2014 at 10:21 UTC | |
by tobyink (Canon) on Sep 02, 2014 at 10:23 UTC |