Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Answer: How do I reference methods?

( #732283=categorized answer: print w/ replies, xml ) Need Help??

Q&A > object-oriented programming > How do I reference methods? contributed by RocketInABog

Though there are other interesting ways of getting a method reference, there already exists an equivalently straightforward way of doing this.

$ref = \&Class::method; $instance = new Class; $ref->( $instance, @args ); # - calls method of Class for the given i +nstance

Comment on Answer: How do I reference methods?
Download Code
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-11-27 13:29 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (729 votes), past polls