Can you implement a method to act as a +... but for objects instead of
primitives?
I think that there is something like this in C/C++, but what about in
java? Can I add a method that will add two of them together, but instead
of doing say obj1.add(obj2) you can do obj1 + obj2? Can you do the same
for -, *, /, and == & other comparatives? Can you create a primitive, or
would that take modifying the JVM?
No comments:
Post a Comment