Thread: ostream
View Single Post
Old Nov 10th, 2005, 12:59 PM   #6
Animatronic
Programmer
 
Join Date: Jun 2005
Posts: 99
Rep Power: 4 Animatronic is on a distinguished road
I always do inside the class def from simplicity e.g

class foo
{
	int a;
public:
	friend std::ostream& operator << ( std::ostream& os, foo const & f )
	{
		os << f.a;
		return os;
	}
};

btw isnt this:

ostream& operator<<( ostream &stream, const CString &str)
{
        stream << str; <<<<<<<<
        return stream;
}

going to cause an inifinte loop...
Animatronic is offline   Reply With Quote