How to apply arithmetic operations to objects
I am programming a vector class (in the mathematical sense), and it would
be nice if I could do
vector1 + vector2
instead of
vector1.add(vector2)
Is this possible in java? Can I assign a behaviour to an arithmetic
operation like the String class is able to? Or is this hardcoded in the
compiler?
No comments:
Post a Comment