0

Possible Duplicate:
Why are bitwise shifts (<< and >>) used for cout and cin?

I understand that cout and cin overload the bitwise operators << and >>. However, most of the time functions and tools use arguments or parameters to pass information.

Is there a reason in the grand history of C++ that has lead to this being the case?

I know this is a rudimentary thing, but I am fairly new to C++ and searching SO and Google, as well as asking a few folks, has not turned up a good answer.

Community
  • 1
  • 1
Ashterothi
  • 3,268
  • 1
  • 18
  • 34
  • Those operators have kind of evolved to being used for streams, of which input and output are two types. – chris Jul 03 '12 at 22:49
  • 2
    This kind of question should be asked to Bjarne Stroustrup. Also, http://www2.research.att.com/~bs/dne.html – Griwes Jul 03 '12 at 22:49
  • 1
    I don't know the history, but I'm glad it works that way. `cout.print("Hello").print(variable).print("Yes")` is a lot uglier than the `< – TheZ Jul 03 '12 at 22:50

1 Answers1

1

(a) Operator precedence

and

(b) It looks nice - the form of the operators suggests their function

Stuart Golodetz
  • 19,702
  • 4
  • 49
  • 80