0
C++ Operator Overloading
I have 6 operator functions (+,-,*,/, istream, ostream) The user has to enter 2 ratio numbers for adding subtracting multiplication etc. How to call the operator if I had to select addition? Do I need to create 2 objects to enter 2 ratio numbers?
1 Answer
0
You do :
ratio a,b;
cout<<a+b;
// Calls ratio's + overload.
// Assuming that your class is named 'ratio'...