#!/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 ::: UseParant :::$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 ::: $GetValue2\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;
####
#!/usr/bin/perl
use Child1Class;
$object = Child1Class->new();
print $object->useChild1();