Why do we use virtual functions?

Answer Posted / mona kawale

when there are two same classes in derived and base class then at the tym of running programm compiler get confuse about which function should b call first so it call derived class function automatically....but if we wrote base class function as virtual function then compiler will not get confuse.....

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the important feature of inheritance?

628


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1662


What are the two different types of polymorphism?

666


What is the use of oops?

614


What is pure oop?

587






Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1633


What is polymorphism give a real life example?

553


What is encapsulation with example?

570


Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

1999


What does it mean when someone says I oop?

574


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1887


What do you mean by abstraction?

604


What is abstraction in oops with example?

765


What is difference between pop and oop?

597


if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?

2748