Search code examples
c++initializing

'Bracket initializing'. (C++)


I'm learning C++ at the moment, C++ Primer plus. But I just felt like checking out the cplusplus website and skip a little forward to file handling.

I pretty much know the basics of file handling coming from java, php, visual basic. But I came across a pretty weird line.

ostream os(&fb);

fb represents a filebuf. I just don't get the syntax of this, but I can figure out that it's the same as:

ostream os = &fb;

But I never really read about this way of initializing variables.

So I'm wondering. Am I just senseless and missing out a real useful feature the entire time? Is this way of initializing just old? Is it something different?

Thanks in advance.


Solution

  • Perhaps you should read this and this