title: What is this weird colon-member (" : ") syntax in the constructor?
body: <p>Recently I've seen an example like the following:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Foo {
  public:
    int bar;
    Foo(int num): bar(num) {};
  };
  
  int main(void) {
    std::cout &lt;&lt; Foo(42).bar &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>What does this strange <code>: bar(num)</code> mean? It somehow seems to initialize the member variable but I've never seen this syntax before. It looks like a function/constructor call but for an <code>int</code>?  Makes no sense for me. Perhaps someone could enlighten me. And, by the way, are there any other esoteric language features like this, you'll never find in an ordinary C++ book?</p>