How the V-Table mechanism works?

Answer Posted / ramesh

V-table is specific to class. No matter how many objects
are created for this class, only one virtual table exists.
Each virtual function in the class will have a pointer in
Vtable.

Whenever a code like Base *b = new Derived; is encountered,
during compile time the search will happen in Base class.
Its only during run time the actual objects are invoked and
the fucntion present in derived class will be called.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to declare a pointer to an array of integers?

647


Is c++ harder than java?

572


What is a storage class? Mention the storage classes in c++.

595


Is it possible to provide special behavior for one instance of a template but not for other instances?

635


Explain how functions are classified in C++ ?

809






Which coding certification is best?

572


What is diamond problem in c++?

542


What is ctime c++?

581


What is a far pointer? where we use it?

617


Why do we use structure in c++?

578


Distinguish between a # include and #define.

651


Can a constructor return a value?

575


Explain how a pointer to function can be declared in C++?

583


Is c++ a pure oop language?

602


Which function should be used to free the memory allocated by calloc()?

594