First page Back Continue Last page Graphics
Overloading insertion operator
<<
Compiler (and library function) knows how to output standard types.
cout << 12 << endl; // outputting an int
cout << 12.45 << endl; // outputting a float
cout << 'c' << endl; // outputting a char
etc. etc.
But, the compiler doesn't know how to output a class object.
cout << T1 << endl; // ??????
Defining a member function for << allows this!