0

This comes down to my 3rd paragraph from my previous post.

Where is outfile declared that is visible in FRACTION.CPP? It is not declared in the file itself and it certainly isn't declared in fstream. FRACTION.H doesn't declared it or include a file that does. That only leaves StdAfx.h and since you are getting the error I assume it is not declared in there.

If you want to use outfile in Fraction::print then you will need to declare it somewhere that is visible to Fraction::print.

However I come back to my previous point, this is really poor programming style, it would be better to declare Fraction::print as

void Fraction::print(ostream& out) const
{
	out<<numerator<<"/"<<denominator;
}

and pass outfile into print as a parameter.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.