Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Home made operands

by Plankton (Priest)
on Nov 12, 2011 at 16:55 UTC ( #937760=note: print w/ replies, xml ) Need Help??


in reply to Home made operands

Does use overload sound like what you are looking for? As in ...

... use overload "-" => \&minus, "+" => \&plus, "*" => \&mult, "bool" => \&bool; ... sub plus { my $u = shift; my $v = shift; return new Vector2D ( $u->getx() + $v->getx(), $u->gety() + $v->gety() ); } ...
But these would be homemade operators ;)


Comment on Re: Home made operands
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (17)
As of 2015-07-29 14:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls