title: C++ Destructors with Vectors, Pointers,
body: <p>As far as I know, I should destroy in destructors everything I created with <code>new</code> and close opened filestreams and other streams.
  However, I have some doubts about other objects in C++:</p>
  
  <ul>
  <li><p><code>std::vector</code> and <code>std::string</code>s: Are they destroyed automatically?</p></li>
  <li><p>If I have something like</p>
  
  <pre><code>std::vector&lt;myClass*&gt; 
  </code></pre>
  
  <p>of pointers to classes. What happens when the vector destructor is called?<br>
  Would it call automatically the destructor of <code>myClass</code>? Or only the vector is destroyed but all the Objects it contains are still existant in the memory?</p></li>
  <li><p>What happens if I have a pointer to another class inside a class, say:</p>
  
  <pre><code>class A {
    ClassB* B;
  }
  </code></pre>
  
  <p>and Class A is destroyed at some point in the code. Will Class B be destroyed too or just the pointer and class B will be still existent somewhere in the memory? </p></li>
  </ul>