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

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).

1893


What is oops?what is its use in software engineering?

769


Why we use classes in oop?

777


What is the advantage of oop over procedural language?

853


What is inheritance and how many types of inheritance?

825


What is the difference between a mixin and inheritance?

752


What is the main purpose of inheritance law?

951


What is an example of genetic polymorphism?

875


What is the main feature of oop?

902


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1386


What is encapsulation and abstraction? How are they implemented in C++?

854


What is constructor in oop?

827


Explain the advantages of inheritance.

877


write a programe to calculate the simple intrest and compund intrest using by function overlading

1903


What is destructor give example?

814