C/C++ Arena

Step 3 of 5

Printing with operator<<

To make std::cout << obj work, overload << for std::ostream. It must return the stream so calls can chain:

std::ostream& operator<<(std::ostream& os, const Vec2& v) {
    return os << "(" << v.x << ", " << v.y << ")";
}

Your turn: make Score printable as T 13 - 7 CT.

Previous: operator== and != Next: operator[]