Ok, I'm stuck. I've done this before, but now it seems to not work anymore.
Yeah, it's homework assignment, but I've already did everything, just getting this error about ostream unable to access rational class private stuff... This is my weakness... Can you explain what I'm doing wrong? I'm stumped...
class Rational
{
...
public:
friend ostream& operator << (ostream&, Rational&);
};
..
ostream& operator << (ostream& bout, Rational& Rat)
{
bout << Rat.Numerator << "/" << Rat.Denominator;
return bout;
}
The error I'm getting is this:
C:\Games\Brent's Games\Homework\HW1\Rational.cpp(158) : error C2248: 'Numerator' : cannot access private member declared in class 'Rational'
C:\Games\Brent's Games\Homework\HW1\Rational.cpp(7) : see declaration of 'Numerator'
C:\Games\Brent's Games\Homework\HW1\Rational.cpp(172) : error C2248: 'Denominator' : cannot access private member declared in class 'Rational'
C:\Games\Brent's Games\Homework\HW1\Rational.cpp(8) : see declaration of 'Denominator'
Much obliged.
[Edited by - Zeraan on September 5, 2005 10:55:54 PM]