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?

20th Mar 2018, 5:06 AM
Winson
Winson - avatar
1 Answer
0
You do : ratio a,b; cout<<a+b; // Calls ratio's + overload. // Assuming that your class is named 'ratio'...
20th Mar 2018, 5:33 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar