Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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 ( [id://1099243]=note: print w/replies, xml ) Need Help??


in reply to Re: Point me in the right direction with OO inheritance and static variables
in thread Point me in the right direction with OO inheritance and static variables

Thanks! How does the child object "know" which class is the parent? (I hope my terminology is correct)

In other words, when i'm creating an object in the class which is inheriting the attributes, how does it know where SUPER points?

Thanks again for your help!

  • Comment on Re^2: Point me in the right direction with OO inheritance and static variables

Replies are listed 'Best First'.
Re^3: Point me in the right direction with OO inheritance and static variables
by choroba (Cardinal) on Sep 02, 2014 at 10:21 UTC
    In the child class, you specified
    use parent 'Parent::Class';

    right? See parent.

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^3: Point me in the right direction with OO inheritance and static variables
by tobyink (Canon) on Sep 02, 2014 at 10:23 UTC

    The child class has a package variable called @ISA which tells it the parent class. This is an array because multiple inheritance is supported.

    package Child { require Parent; our @ISA = "Parent"; }

    For some reason, setting @ISA directly like that is not very fashionable, and a lot of people prefer to use a module like base, parent, or superclass to do so. Using one of those modules ensures that @ISA gets set at compile-time rather than run-time, though in practice this feature of them is almost never important.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1099243]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found