-2

I have overloaded the << operator here. I tried printing out the object in my main class and it looks perfect. The problem is when I try to pass that object to stringstream, the string stream object gives me empty.

stringstream printing code

Sisir
  • 4,584
  • 4
  • 26
  • 37
  • Please your `TimeSpan` class code – Sisir Oct 12 '19 at 19:09
  • 1
    Please post code *in the question*. Firstly, so that others can cut and paste it into an IDE and secondly so that it has the same life-time as the question. – marko Oct 12 '19 at 19:26

1 Answers1

0

Your operator<<(ostream& output, ...) ignores its output parameter, and always prints to std::cout. output stream is left unchanged (except when it happens to also refer to std::cout).

Igor Tandetnik
  • 50,461
  • 4
  • 56
  • 85