I have a difficult to understand the subject of overloading operator in C++ and Java.
For example, I define a new class Fraction:
class Fraction { 
public: 
    Fraction (int top, int bottom) { t = top; b = bottom; } 
    int numerator() { return t; } 
    int denominator() { return b; } 
private: 
    int t, b; 
};
and I want to overload the operator << for printing Fraction. How I do it? I need to overload it inside Class Fraction or outside Class Fraction?
In java - Is it possible to overload operator? How I can do it there (for example, I want to overload the operator +).
If there is a metrial about this subject, It will be great.
 
     
     
     
     
    