What are the fields of vtable



What are the fields of vtable..

Answer / 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

More OOPS Interview Questions

what are the characteristics of oops?

7 Answers   NIIT,


create a c++ program that will accepts 9 inputs using 3 by 3 array.

1 Answers  


What are oops functions?

0 Answers  


Program to open a file with First argument

1 Answers   TCS,


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

2 Answers  






pointers are support in C#? if yes then how to use it?

8 Answers   Softvision Solution,


What is the difference between abstraction and polymorphism?

0 Answers  


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<<k; } //please comment on the output

0 Answers  


How to deploy web appliction in web logic ?

1 Answers   Unisys,


How compiler selects(internally) required overridden function in inheritance?

2 Answers   CSC, Infinite Computer Solutions,


What is for loop and its syntax?

0 Answers  


Why do we use class?

0 Answers  


Categories