How to define a destructor of a class B if B uses class A (c++)?
<p>I have a class <code>A</code>.
<code>A</code> has its own destructor.</p>

<p>I use <code>A</code> to define <code>B</code> as follows.</p>

<pre><code>class A{
  protected:
    int* array;
  public:
    A(int size){array = new int[size];}
    ~A() { delete [] array;}

}

class B{
 public:
  A x;
}
</code></pre>

<p>How should I define the destructor for <code>B</code>?</p>

<p>Thanks in advance.</p>
