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

Write a macro for swapping integers

5 Answers  


Pls...could any one tell me that whether we can access the public data memeber of a class from another class with in the same program. Awaiting for your response Thanku

4 Answers  


What is meant by oops concept?

0 Answers  


Conversion from a basic type to a class type may be achieved using______________

5 Answers   HCL,


define oops with class and object

5 Answers   HCL, Tech Mahindra,


Why do we use polymorphism?

0 Answers  


who is the father of OPPS

4 Answers   Infosys, TCS,


Who invented oop?

0 Answers  


Why and when is a virtual destructor needed?

5 Answers  


What are the features of oop?

0 Answers  


what uses of c++ language?

3 Answers  


which are the 4 members functions in c++ objects that can either be declared explicitly by programmer or implementation if nt available.

4 Answers  


Categories