in reply to Re: OO Perl Inheritance - Is it possible somehow?
in thread OO Perl Inheritance - Is it possible somehow?

I definitely do not see the big picture here.

If I am not able to reach the child's getSex() sub in a simply way, then whats the point of the inheritance. I mean the Parent should know about the child's subs.

If I do the inheritance coming from the other direction, so the Son+Daugther are the parents and the Kid is the child then I will be able to reach the subs, but this is logically wrong.

Kid.pm ------ package Kid; @ISA = (Son); use Son; sub new { } Son.pm ------- package Son; sub new { } sub getSonSex { print("I'm a boy \n"); } test.pl ------- use Kid; use Son; $kid = Kid->new(); # It's OK $kid->getSonSex();
I'm getting more and more confused about these OO terms :)

Replies are listed 'Best First'.
Re^3: OO Perl Inheritance - Is it possible somehow?
by kEndE (Novice) on Dec 17, 2008 at 17:08 UTC
    ohhh I am wrong. The child knows about the Parent's subs. :) Because he/she inherits the knowledge of the Elders :)