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

explain sub-type and sub class? atleast u have differ it into 4 points?

0 Answers   Infosys,


What are main features of oop?

0 Answers  


What is interface? When and where is it used?

0 Answers  


c++ is a pure object oriented programming or not?

5 Answers   Wipro,


What is inheritance in oop?

0 Answers  






What do you mean by binding of data and functions?

3 Answers  


What is an example of genetic polymorphism?

0 Answers  


Which is not an object oriented programming language?

0 Answers  


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


What is sub classing in c++?

1 Answers  


What is OOPS and How it is different from Procedural Programming ?

23 Answers   HP, Infosys, Thyrocare,


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1 Answers  


Categories