title: Why we actually need runtime polymorphism?
body: <p>I'm trying to understand a polymorphism but I don't understand why we need runtime polymorphism if static polymorphism works fine for calling members of a class.</p>
  
  <p>Like, suppose this was a problem.</p>
  
  <pre><code>#include &lt;bits/stdc++.h&gt;
  using namespace std;
  class base{
      public:
          virtual void fun(){
              cout&lt;&lt;"base called"&lt;&lt;endl;
          }
  };
  class derived:public base{
      public:
          void fun(){
              cout&lt;&lt;"derived called"&lt;&lt;endl;
          }
  };
  int main() {
  
      base b,*b1;
      derived d;
      b1 = &amp;d;
      b1-&gt;fun();
      // b.fun();
      // d.fun();
  }
  </code></pre>
  
  <p>suppose this was my code and I want to access the function of derived or base class and I was able to do it by simply creating an object of that class so if there is no problem then why we try to call the object using references (runtime polymorphism).
  Can someone explain the actual need for runtime polymorphism or if it is possible can you explain it by using any <strong>real-life scenarios</strong>??</p>