Message from C, C++ talks

June 2019

— Its a function that is called when the object is removed from memory

— Its one concept of OOP

— But "couting" doesn't call a destructor. Or does it? What object would it want to destruct?
I'm confused because I remember "couting" text without using endl before, and it seemed to output fine, so I'm not sure when the flushing actually happened.

Message permanent page

— Call cout.flush();

— 

But from what I remember I didn't need to do that for the text to be output to the console. What am I not getting here?

— You don't need to do it when

1. you use endl
2. The internal buffer of cout is full
3. The code/program leaves scope of cout (end of program)

In all three cases a flush is implicitly done

Message permanent page

— I don't know what you are not getting 😅

— So if I used a cout in the middle of a program without an endl, there is no way the text would show up unless I filled the buffer (which I assume isn't that small)?

Message permanent page

— If you need to flush, use std::flush

— True

— In order for new programmers to understand what you do

— I think I get what I did't get now. :P

— Apparently reading from cin flushes the buffer. That's what confused me.

— Anyone has c++ pdf that I can download?

— The internet ;)