Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Motivation for replacing object methods at runtime

by lodin (Hermit)
on Jun 27, 2008 at 20:47 UTC ( [id://694448]=note: print w/replies, xml ) Need Help??


in reply to Motivation for replacing object methods at runtime

If Perl had better support for anonymous classes a simple solution would be to just create a specialization of the Divisor class (i.e. a subclass).

# Pseudo code! my $two = new subclass of Divisor { sub divides { $_[1] =~ /[02468]\z/ } };
There would be no need to modify or redefine anything in the Divisor class.

lodin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2024-04-24 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found