O
Ook
I'm a but fuzzy about this. You would call it like this
olynomial poly; //
Polynomial is my class with various properties
cin >> poly;
In the function itself, I would, for example, do the following:
istream& operator>>(istream& is, Polynomial& poly)
{
is >> poly._size;
is >> poly._coefficient[1];
return is;
}
Since we are passing poly by reference, I can modify it's properties
directly. This is where I loose it. If I'm modifying the properties of
poly directly in the overloaded function, why do I need to "return is"?
What exactly happens when you return from this function, and am I on the
right track about modifying the properties of poly in the function itself?
Polynomial is my class with various properties
cin >> poly;
In the function itself, I would, for example, do the following:
istream& operator>>(istream& is, Polynomial& poly)
{
is >> poly._size;
is >> poly._coefficient[1];
return is;
}
Since we are passing poly by reference, I can modify it's properties
directly. This is where I loose it. If I'm modifying the properties of
poly directly in the overloaded function, why do I need to "return is"?
What exactly happens when you return from this function, and am I on the
right track about modifying the properties of poly in the function itself?