What is the output of below C++ program?
cout<<"base virtual disp"<disp();
base virtual disp
compile time error, derived class can't override non virtual function of base class.
compile time error in main method.
If derived class redefines the method of a base class, and if you access derived class functionality by using base class pointer then it will call base class function if the base class function is not a virtual. So it prints base virtual disp.
Back To Top