title: Base class pointer vs inherited class pointer?
body: <p>Suppose I have a class <code>Dog</code> that inherits from a class <code>Animal</code>. What is the difference between these two lines of code?</p>
  
  <pre><code>    Animal *a = new Dog();
      Dog *d = new Dog();
  </code></pre>
  
  <p>In one, the pointer is for the base class, and in the other, the pointer is for the derived class. But when would this distinction become important? For polymorphism, either one would work exactly the same, right?</p>