title: Dynamic memory allocation in constructor
body: <p>I am learning dynamic memory allocation. I have the following class where 'class A' should own a dynamically allocated array in the constructor. Also the copy constructor and destructor should be modified. This is what I have so far...</p>
  
  <pre><code>#include &lt;iostream&gt;
  #ifndef A_HH
  #define A_HH
  
  #include "B.hh"
  
  class A {
  public:
  
    A() {  B *array = new B[12];}
    A(const A&amp;) { /* Do not know what to put here..*/ }
    ~A() { delete[] array;}
  
  private:
  
     //B array[12] ; &lt;- This is the array that I have to modify so it becomes dynamic. 
     B *array;
  } ;
  
  #endif 
  </code></pre>