what is virtual function?

Answer Posted / laxmikant

A virtual function is a function which is precedded by the
key word derived is declared in the base class.It is
normally used to achieve run time polymerphism.That means
we can override the base class function in the derived
class.We can invoke the virtual function through the base
class pointer depending upon the contents to which the base
class pointer points to.
Generally the implementation of virtual
class was found in inheritance where the base class
function is override in the derived class.

Is This Answer Correct ?    23 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the real time example of encapsulation?

595


Give two or more real cenario of virtual function and vertual object

1851


What is a function in oop?

631


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

637


What is polymorphism and example?

592






What is polymorphism explain?

691


What is inheritance in oop?

604


What is difference between multiple inheritance and multilevel inheritance?

603


Which method cannot be overridden?

578


What is protected in oop?

604


What is the difference between inheritance and polymorphism?

590


What is the difference between abstraction and polymorphism?

617


How is polymorphism achieved?

583


Why do we use polymorphism in oops?

579


any one please tell me the purpose of operator overloading

1965