How the V-Table mechanism works?

Answer Posted / deepa balamurugan

If the both Base and the Derived class having the same
function then the Base class funtion should be declared as
virtual function. Then the C++ determines which function to
be called at the runtime based on the type of the object
pointed to by the Base pointer rather than the type of the
pointer.
As soon as the compiler reads the keyword virtual ,it will
create the vtable contains the address of the virtual
function inside that class and as soon as vtable is
created ,vptr is initialized to the proper vtable.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a called function determine the number of arguments that have been passed to it?

669


Is there a c++ certification?

608


How is data hiding achieved in c++?

581


Explain what is class definition in c++ ?

606


Define private, protected and public access control.

613






Describe new operator?

628


Why was c++ made?

660


What are the general quetions are in DEna bank manager IT/System interviews?

1541


Write a program to find the Fibonacci series recursively.

621


how to connect with oracle 9i with server in socket program in c/c++

1855


How can I learn dev c++ programming?

575


What is helper in c++?

580


Write a Program to find the largest of 4 no using macros.

590


Is string data type in c++?

593


What is the use of default constructor?

579