Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Overloading multiplication involving BigInt

by grondilu (Friar)
on Jan 14, 2012 at 15:17 UTC ( [id://947907]=note: print w/replies, xml ) Need Help??


in reply to Re: Overloading multiplication involving BigInt
in thread Overloading multiplication involving BigInt

Well, I had a look at Math::BigInt source code and it seemed to me that the '*' overloading had already a lot of elsif branches. I just don't want to reinvent the wheel and redo what has already been done. Basically I whish I could just say "if the second operand is a My::Custom::Object then do this, otherwise just do whatever '*' does in the Math::BigInt class".

About explicit blessing, I just don't see how I could do it otherwise, unless I use a constructor anyway. But now that you make me think of it , I wonder if the magic of bigint wouldn't be inherited. I have to check this out, indeed.

You are right about using overloading not being necessary. But it would definitely be cool.

  • Comment on Re^2: Overloading multiplication involving BigInt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://947907]
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-18 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found