In the same way cout << "hello" works,
I would want to write a class to use <<
Some skeleton ?
Thanks
Simply overload operator<<
E.g
class <your classname> {
public :
friend ostream& operator<<(ostream& os, const <your classname>& obj);
}
ostream& operator<<(ostream& os, const <your classname>& obj) {
//do wat you want with obj
//e.g os << setprecision(2) << obj.x << " " << obj.y << "\n";
return os;
}
Umm, a little abstract for me (The C++...), but thank you very much.
Read up on C++ Operator Overloading topic. A pretty useful and intuitive feature if used in the correct context. Don't abuse it though.