Sign in to follow this  
SgtSparky

Java - class declared operators

Recommended Posts

Java doesn't support operator overloading. You just have to write methods that will do the operations..

for instance:

Vector vec1 = new Vector (1.0f, 2.0f, 3.0f);
Vector vec2 = new Vector (5.0f, 5.0f, 5.0f);

Vector vec3 = vec1.dotProduct (vec2);

or similar..

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
Unfortunately, you cannot overload operators in Java.

You've got to do it all through function calls, e.g.*** Source Snippet Removed ***Damn you Java...


Dang, I was afraid of that. D:

Thanks anyways!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this