Re: Newbie: cloning a Number
- From: Philipp <sicsicsic@xxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 14:22:27 +0100
Andreas Leitgeb wrote:
Philipp <sicsicsic@xxxxxxxxxxx> wrote:
My application needs some parameters (Number).
So, you could just as well use double or long.
Yes this is correct.
I just thought that this was the whole purpose of a "Number" class. ie not needing to say if it's actually an integer or a double, but leaving this to when real calculation is done.
Also my parameters are displayed in JFormattedTextFields which I would like not to display Integers and Double the same way (with or witout fraction digits). So keeping this info seemed important to me.
From my C++ background I would have implemented the standard math operators (+ - * /) on Number such that the polymorphism is used (ie if Number*Number is actually Integer*Integer: do integer math. If it's Double*Integer do double math). But this does not seem to be the purpose of the Number class in Java.
(what's it's purpose actually?)
Best regards
Phil
.
- References:
- Newbie: cloning a Number
- From: Philipp
- Re: Newbie: cloning a Number
- From: Patricia Shanahan
- Re: Newbie: cloning a Number
- From: Philipp
- Re: Newbie: cloning a Number
- From: Patricia Shanahan
- Re: Newbie: cloning a Number
- From: Andreas Leitgeb
- Re: Newbie: cloning a Number
- From: Patricia Shanahan
- Re: Newbie: cloning a Number
- From: Philipp
- Re: Newbie: cloning a Number
- From: Andreas Leitgeb
- Newbie: cloning a Number
- Prev by Date: Re: Giving an application a window icon in a sensible way
- Next by Date: Re: Giving an application a window icon in a sensible way
- Previous by thread: Re: Newbie: cloning a Number
- Next by thread: Re: Newbie: cloning a Number
- Index(es):
Relevant Pages
|