How std::cout works [duplicate]

Question:

I accidentally found:

cout << cout;

The output is some address. What does this address mean, and why is it shown?

I am looking this question.

Answer:

Because ostream overload operator
void*()
, and that's the closes match for the call to operator
<<
, the result of the cast (void*)cout is
printed. Which in your case is that address. Remember that cout is
an object.

Basically the call translates to:

cout.operator<<((void*)cout);
上一篇:【译】第五篇 SQL Server代理理解代理错误日志


下一篇:css整理-03 文本