What is the use of having virtual functions then?
You can achieve dynamic polymorphism with it.
you can achieve static polymorphism with it.
it is of no use, more over it adds extra over head of virtual tables for each class.
You can achieve dynamic polymorphism with virtual functions. That means, with out knowing the class type of an object, you can call functions of various classes of same type at run time, by passing different kinds of objects. Note: Provided base class is having virtual function and all derived classes are implementing that virtual functions in their specific way.
Back To Top