title: some questions about "new" operator
body: <p>Here is a simple rectangle area calculating cpp code and I have some questions around it:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  using namespace std;
  class CRectangle
  {
          int *width, *heigth;
      public:
          CRectangle(int, int);
          ~CRectangle();
          int area() { return (*width * *heigth);}
  };
  
  CRectangle :: CRectangle(int a, int b)
  {
      width = new int;
      heigth = new int;
      *width = a;
      *heigth = b;
  }
  
  CRectangle :: ~CRectangle()
  {
      delete width;
      delete heigth;
  }
  
  void main()
  {
      CRectangle rect1(3,4), rect2(5,6);
      cout &lt;&lt; "rect1 area = " &lt;&lt; rect1.area() &lt;&lt; "\n";
      cout &lt;&lt; "rect2 area = " &lt;&lt; rect2.area();
      getch();
  }
  </code></pre>
  
  <ol>
  <li>why in such object oriented codes we use pointers,I mean what's the advantage(s)?</li>
  <li>in this code after creating the object <code>rect1(3,4)</code> we create <code>rect2(5,6)</code> ,with doing this, logically (I think) 5 and 6 are replaced instead of 3 and 4 in the memory sections that width and height are pointing to , so 3 and 4 are not available anymore ,<strong>but they are</strong>.</li>
  </ol>
  
  <p>Please explain what exactly happens?  </p>