Answer Posted / chandra
Vtable consists of function pointers pointing to the
virtual functions of their respective class.
Ex: Class A
{
public:
virtual void fun1();
virtual void fun2();
};
Class B: public A
{
public:
Virtual void fun2();
};
Now there will be 2 vtables created for the 2 classes. in
first vtable there will be 2 function pointers pointing to
fun1 and fun2.
one more vtable is created for the class B. in which this
vtable also consists of two function pointers because class
B is derived from class A. so all the functions are
derived . so in this vtable two function pointers are
present. one function pointer pointing to fun1 and one more
function pointer pointing to fun2 of derived class.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is inheritance in oop?
What is for loop and its syntax?
Can a varargs method be overloaded?
What is ambiguity in inheritance?
What is multilevel inheritance in oop?
What is persistence in oop?
What does it mean when someone says I oop?
Why do we use oops?
What is difference between pop and oop?
What is a superclass in oop?
What is polymorphism and example?
Why do we use inheritance?
#include
Can static class have constructor?
Describe these concepts: Polymorphism, Inheritance and Abstraction.