I'm coming back to c++ after using Java for a long time. In Java overriding the toString method on an object allows the object to be automatically translated into a string and concatenated to other strings.
class Test {
public static void main(String[] args) {
System.out.println(new Test() + " There"); // prints hello there
}
public String toString() {
return "Hello";
}
}
Is there anything similar that would allow me to stream an object into cout?
cout << Test() << endl;