title: Why use base class pointers for derived classes
body: <pre><code>class base{
      .....
      virtual void function1();
      virtual void function2();
  };
  
  class derived::public base{
      int function1();
      int function2();
  };
  
  int main()
  {
      derived d;
      base *b = &amp;d;
      int k = b-&gt;function1() // Why use this instead of the following line?
      int k = d.function1(); // With this, the need for virtual functions is gone, right?
  
  }
  </code></pre>
  
  <p>I am not a CompSci engineer and I would like to know this. Why use virtual functions if we can avoid base class pointers?</p>