editi has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl package ParantClass; sub new { my $self = {}; $self->{Parant_Var1}=undef; $self->{Parant_Var2}=undef; bless($self); return $self; } sub UseParant { my $self = shift; if(@_) { $self->{Parant_Var1}=shift; $self->{Parant_Var2}=shift; my $SentToChild1=$self->{Parant_Var1}; my $SendToChild2=$self->{Parant_Var2}; $SendToChild1=$sendToChild1+500; $SendToChild2=$sendToChild2+"1"; print "I Entered in to the Parant Class Method ::: Use +Parant :::$SentToChild1 and $SentToChild2 are Going to Chid Class So + Take Care of Data\n\n"; push(@GoesChild,$sendToChild1); push(@GoesChild,$sendToChild2); } return @GoesChild1; } return 1;
#!/usr/bin/perl package Child1Class; use ParantClass; our ($GetValue1,$GetValue2); sub new { my $self=ParantClass->new(); print "Now I am in Child Module\n\n"; print "Send a values to Parant Class from Child1 "; ($GetValue1,$GetValue2)=$self->UseParant(500,"Child"); print "Get Value from Parant Module ::: $GetValue1 ::: $GetVal +ue2\n\n"; return $self; } sub UseChild1 { my ($value1,$value2)=ParantClass->UseParant(1000,"From Child") +; print "Parant Class Values=$value1 ----- $value2 \n\n"; #my $self = shift; print "This Values go to perl program and display the Values : +:::\n\n\n"; } return 1;
help me to rectify this error. thank you#!/usr/bin/perl use Child1Class; $object = Child1Class->new(); print $object->useChild1();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error in Inheritance Class
by Joost (Canon) on Mar 12, 2007 at 10:33 UTC | |
|
Re: Error in Inheritance Class
by Ojosh!ro (Beadle) on Mar 12, 2007 at 11:02 UTC | |
|
Re: Error in Inheritance Class
by agianni (Hermit) on Mar 12, 2007 at 17:29 UTC |