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 does it mean when someone says I oop?
What is difference between oop and pop?
What is inheritance in simple words?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What is difference between inheritance and polymorphism?
What is polymorphism and why is it important?
Why do we use encapsulation in oops?
What makes a language oop?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
Can we create object of interface?
What is the difference between a constructor and a destructor?
What is the main feature of oop?
Can we define a class within the interface?
What is overriding in oops?
Whats oop mean?