|
-
February 2nd, 2010, 06:03 PM
#1
Noob question
really simple question
Is there anyway to overload the return value as I have tried to do below
class currency
{
private Int64 Total;
public Int64 currency
{
get
{
return (Total / 1000);
}
set
{
Total = (value * 1000);
}
}
public Int32 currency
{
get
{
return (Int32)(Total / 1000);
}
set
{
Total = (Int64)(value * 1000);
}
}
Thanks
-
February 2nd, 2010, 06:13 PM
#2
Re: Noob question
No, though you could wrap the int in your own class and use polymorphism.
Also, you are doing integer division which is sure to cause problems soon. Currency should be handled using the decimal type.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|