title: Owning instance of object vs owning pointer
body: <p>Let's say I have two class A and B. There are 2 ways in which class B can use A.</p>
  
  <p>First:</p>
  
  <pre><code>class B
  {
    A *a;
  }
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>class B
  {
    A a;
  }
  </code></pre>
  
  <p>Why most of the C++ libraries prefer to use <code>First</code> version as compared to <code>Second</code>. What could be the disadvantage of using Second approach. Does it relate to Stack vs Heap assignment? Please clarify.</p>