title: C++ new and delete ptr wrapper class
body: <p>There was a question asked about what a C++
  wrapper class is, and I think he provided a good answer. His username: GManNickG from Stack Overflow provided the following code with his answer:</p>
  
  <pre><code>class int_ptr_wrapper
  {
  public:
      int_ptr_wrapper(int value = 0) :
      mInt(new int(value))
      {}
  
      // note! needs copy-constructor and copy-assignment operator!
  
      ~int_ptr_wrapper()
      {
          delete mInt;
      }
  
  private:
      int* mInt;
  };
  </code></pre>
  
  <p>That code prompted me with a question. I've heard from several different people that its considered bad practice to use the new and delete keywords.
  Is there a certain situation in which I should use new or delete? Also If I wrote the code above like below, which is considered better practice?</p>
  
  <pre><code>class int_ptr_wrapper
  {
  public:
      int_ptr_wrapper(int value = 0) :
          m_int(&amp;value) {}
  private:
      int* m_int;
  };
  </code></pre>