title: (C++ syntax help) constructor doesn't work as expected without pointers
body: <p>I am learning C++, and currently confused with the constructor syntax. I am familiar enough with C, so it's always okay to explain me in C terms if possible.</p>
  
  <p>The code below doesn't work at all. The member variables doesn't get initialized as expected. I can only see trash values somewhere in memory printed.</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  class Point
  {
      struct M;
      M* m;
  
  public:
      Point(int x, int y);
      ~Point();
      void print();
  };
  
  struct Point::M
  {
      int x;
      int y;
  };
  
  Point::Point(int x, int y)
      : m {new M {x, y}} {}
  
  Point::~Point()
  {
      delete m;
  }
  
  void Point::print()
  {
      std::cout &lt;&lt; m-&gt;x &lt;&lt; ' ' &lt;&lt; m-&gt;y &lt;&lt; std::endl;
  }
  
  int main()
  {
      const auto N = 5;
      std::vector&lt;Point&gt; v;
      for (auto i = 0; i &lt; N; ++i)
      {
          v.push_back(Point(i, i + 1));
      }
      for (auto i = v.begin(); i != v.end(); ++i)
      {
          i-&gt;print();
      }
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>But if I edit the main method as follows,</p>
  
  <pre><code>int main()
  {
      const auto N = 5;
      std::vector&lt;Point*&gt; v;
      for (auto i = 0; i &lt; N; ++i)
      {
          v.push_back(new Point(i, i + 1));
      }
      for (auto i = v.begin(); i != v.end(); ++i)
      {
          (*i)-&gt;print();
      }
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>besides that there is an obvious memory leak, the program works as intended without trash values.</p>
  
  <p>What am I missing?</p>