when do we need virtual functions in c++
when a derived class inherits from a base class , an object of the derived class may be referred to via a pointer or reference of the base class type instead of the derived class type