Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Advocacy > Re: Operator Ov...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 2407 of 2456
Post > Topic >>

Re: Operator Overloading (Was: In Praise of Strong Typing)

by Bartlomiej Golenko <bartek@[EMAIL PROTECTED] > Jun 23, 2008 at 02:00 AM

Daniel Pitts <newsgroup.spamfilter@[EMAIL PROTECTED]
> wrote:
> This is not bad code (albeit C++ code)
> Vector operator+(const Vector &left, const Vector &right) {
>      Vector result;
>      for (int i = 0; i < Vector::size; ++i) {
>         result[i] = left[i] + right[i];
>      }
>      return result;
> }
> ...
> myNewVect = someVect + someOtherVect;

Its pure evil. Consider this:

myNewVect = someVect * someOtherVect;

What kind of product is it ? 
- inner product ? 
- tensor product ? 
- cross product ?
- carthesian product ?

The fact that YOU know exactly how did you overload operator* does 
not necessarily mean everyone else does as well.

Regards, BG
 




 7 Posts in Topic:
In Praise of Strong Typing
Roedy Green <see_websi  2008-06-22 16:53:28 
Re: In Praise of Strong Typing
Daniel Pitts <newsgrou  2008-06-22 11:21:34 
Re: In Praise of Strong Typing
Roedy Green <see_websi  2008-06-22 20:07:33 
Operator Overloading (Was: In Praise of Strong Typing)
Daniel Pitts <newsgrou  2008-06-22 15:52:00 
Re: Operator Overloading (Was: In Praise of Strong Typing)
Bartlomiej Golenko <ba  2008-06-23 02:00:06 
Re: Operator Overloading (Was: In Praise of Strong Typing)
ram@[EMAIL PROTECTED] (S  2008-06-23 02:38:59 
Re: Operator Overloading (Was: In Praise of Strong Typing)
Daniel Pitts <newsgrou  2008-06-22 21:43:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 13:25:55 CDT 2008.