title: Incorrect output and variables not initializing in constructor with Eclipse CDT
body: <p>Can someone please explain to me why this code is not working in Eclipse CDT? When I run the program, the output is "310598136." I am also getting an error on line 7 that says "'Member x (and y) was not initialized in this constructor" but I have no idea why they are not initializing when I have the variables in the constructor and memory allocated in the private section of the class. Can someone please tell me what I am doing wrong?</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class Rectangle
  {
  public:
      Rectangle(int a, int b)
      {
          a = x;
          b = y;
      }
      int getArea();
  private:
      int x;
      int y;
  };
  
  int Rectangle::getArea()
  {
      return x * y;
  }
  
  int main()
  {
  
      Rectangle bob(2,3);
  
      cout &lt;&lt; bob.getArea();
  
      return 0;
  }
  </code></pre>