I am trying to overload the >> operator so that when the user inputs a fraction, cin would store the fraction into an Object of type Fraction.
Excerpt from header file:
// Calculator.h
friend istream &operator>>( istream &, Fraction &);
private:
signed int numo; // fraction numerator
signed int deno; // fraction denomenator
char ch; // the '/' character
Excerpt from Implementation file:
//Calculator.cpp
// insertion operator overloading
istream &operator>>( istream &input, Fraction fraction)
{
input >> fraction.numo;
input >> fraction.ch;
input >>fraction.deno;
return input;
}
When I try to compile Calculator.cpp and compile a driver function inside another file, I run into many errors. Why is this not working? Please explain your answer thoroughly, I would like to learn.
UPDATE:
**Errors: variables, numo deno and ch are 'private'