What are the fields of vtable

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


Please Help Members By Posting Answers For Below Questions

What is abstraction example?

625


Can abstract class have normal methods?

616


how to get the oracle certification? send me the answer

1672


What is stream in oop?

842


What is class and example?

570






write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

1647


What is difference between multiple inheritance and multilevel inheritance?

604


What is encapsulation c#?

603


String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?

1944


State what is encapsulation and friend function?

703


What is destructor oops?

625


What is polymorphism and types?

605


What is the main feature of oop?

624


Why is object oriented programming so hard?

616


What are the 3 principles of oop?

621