in reply to Re^3: Data inheritance
in thread Data inheritance
Thats the exact codepackage CommonObject; my $some_var; #constructor sub new{ my $class=shift; my $self = {} ; bless $self, $class; print Dumper($self); return $self; } 1; package MyObject; our @ISA = qw( CommonObject ); use strict; use warnings; sub new{ my $class=shift; my $testName=shift; my $self = CommonObject->new(); $self->$some_var="abcd"; print $self->$some_var; return $self; } 1; #!/usr/bin/perl use MyObject; my $obj=MyObject->new("lkj");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Data inheritance
by ikegami (Patriarch) on Sep 23, 2011 at 21:17 UTC |