I was asked this very basic question in an interview recently.

Why do we need virtual functions or in that matter polymorphism?

I gave various answers from real time projects explaining how it works but could not answer the very basic question pertaining to need.
My question is (or his qns was)

I am anyways going to do the below to call the appropriate functions:

```
<base class> b = new <derived class>;
b.foo();

//can also be implemented as
<derived class> d = new <derived class>();
d.foo();

```

This above is not run time decision, as in I know while writing my code that I am going to put which type of derived object into base. The above can also be implemented directly as shown above. So why virtual?