what is virtual function?
Answer Posted / nk
A virtual function is basically a like normal function but
we can override the function in the derived classes.
Now when we want to access like (fn)
Base * bptr = new Derived();
bptr->fn(); then function of the derived class will be
called only if the function is marked as virtual in the
base class.
i.e the virtual keywork tells to use the function of the
class to which it is pointing to and not to the Base class.
This is called runtime polymorphism.
| Is This Answer Correct ? | 24 Yes | 7 No |
Post New Answer View All Answers
What is polymorphism used for?
Why do we use class?
How many human genes are polymorphic?
what type of questions
What is encapsulation with example?
What is polymorphism programming?
Can we create object of abstract class?
Why do we need oop?
What is this pointer in oop?
class type to basic type conversion
What is the example of polymorphism?
How do you answer polymorphism?
What is inheritance and how many types of inheritance?
What is polymorphism explain?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box