title: C++ constructor automatic variable assign
body: <p>Let's say I have the class:</p>
  
  <pre><code>class foobar {
  public:
      foobar(int _x, int _y) {
          x = _x;
          y = _y;
      }
      int x, y;
  };
  </code></pre>
  
  <p>Is there any way to assign x and y to the values passed to foobar(int, int) instead of assigning them myself?</p>
  
  <p>[Answer]
  Initialization Lists is what I need to use (Thanks all for clarifying)</p>
  
  <p>I can write the code as such:</p>
  
  <pre><code>class foobar {
  public:
      foobar(int x, int y) : x(x), y(y) {}
      int x, y;
  };
  </code></pre>
  
  <p>That means I don't have to underscore my input arguments either x(x) will work as intended</p>