Operator Defining

Reply

Join Date: Oct 2006
Posts: 142
Reputation: venomlash is an unknown quantity at this point 
Solved Threads: 2
venomlash's Avatar
venomlash venomlash is offline Offline
Junior Poster

Operator Defining

 
0
  #1
Oct 8th, 2007
How do you define operators in JAVA? (Can you???)
[prettyplease] help? [/prettyplease]
Beware of the Rancor. I'm not kidding.
If it doesn't compile, try saying "By the power of MegaMan!!!" <this has kinda worked for me, actually...>
Scotland is NOT North Britain, Glasgow does NOT rhyme with "cow", and Robbie Burns is...well, if you don't already know who he was, you're kinda screwed.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,346
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 498
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Operator Defining

 
0
  #2
Oct 8th, 2007
No, operator overloading is not possible in Java. The only thing you can do is add methods for the operations you need.
Last edited by Ezzaral; Oct 8th, 2007 at 2:03 pm. Reason: typo
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 142
Reputation: venomlash is an unknown quantity at this point 
Solved Threads: 2
venomlash's Avatar
venomlash venomlash is offline Offline
Junior Poster

Re: Operator Defining

 
0
  #3
Oct 8th, 2007
Okay, num_reasons_why_cpp_better_than_JAVA++;
thanks anyway, Ezzaral.
Beware of the Rancor. I'm not kidding.
If it doesn't compile, try saying "By the power of MegaMan!!!" <this has kinda worked for me, actually...>
Scotland is NOT North Britain, Glasgow does NOT rhyme with "cow", and Robbie Burns is...well, if you don't already know who he was, you're kinda screwed.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,346
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 498
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Operator Defining

 
1
  #4
Oct 8th, 2007
Originally Posted by venomlash View Post
Okay, num_reasons_why_cpp_better_than_JAVA++;
thanks anyway, Ezzaral.
Well, you are welcome to that opinion of course, but operator overloading isn't really all that special and probably causes more confusion than it's worth. It's syntactic sugar and might save you a couple characters typing, but you can achieve the exact same functionality with methods that perform the operations and no one has to wonder what "+" or "-" does in a given context.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC