what is virtual function in c++

Answer Posted / achal

the concept of vitual function comes when inheritance is at
work. If the overriden function is not made virtual in base
class , then pointer of derived class will call the funtion
in base class(instead it should have called the one from
derived class.)
this is why we make the function in base as virtual.

Is This Answer Correct ?    37 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the ways in which a constructors can be called?

1585


Why is polymorphism important in oop?

637


Can abstract class have normal methods?

616


Why multiple inheritance is not possible?

602


What is abstraction with example?

608






write a program to find 2^n+1 ?

1553


What is coupling in oop?

600


What is encapsulation selenium?

554


What is the point of polymorphism?

590


What is polymorphism in oop example?

518


What is the advantage of oop over procedural language?

630


Why is polymorphism used?

588


What are the types of abstraction?

560


What are the components of marker interface?

604


write a C++ program for booking using constructor and destructor.

2055