C++ Virtual Functions interview questions and answers

What is virtual function? Explain with an example - A virtual function is a member function that is declared within a base class and redefined by a derived class. ....
What is a virtual base class? - An ambiguity can arise when several paths exist to a class from the same base class....
Explain the use of Vtable - Vtables are used for virtual functions. Its a shortform for Virtual Function Table....
Explain the problem with overriding functions - Overriding of functions occurs in Inheritance. A derived class may override a base class member function.....
Overloading vs. overriding - Overriding of functions occurs when one class is inherited from another class. Overloading can occur without inheritance. ....
What is virtual destructor? What is its use? - If the destructor in the base class is not made virtual, then an object that might have been declared....
What is object slicing? - When a Derived Class object is assigned to Base class, the base class' contents in the derived object...