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

Is java a c++?

550


Can user-defined object be declared as static data member of another class?

544


What is an object in c++?

602


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3691


What is ios flag in c++?

669






what is data encapsulation in C++?

596


What are built-in functions? What is the syntax for the definition?

560


What is anonymous object in c++?

626


Why is c++ is better than c?

512


What is #include iostream h in c++?

602


When is the copy constructor called?

620


How do you save a c++ program?

549


What is the exit function in c++?

532


How would you use the functions sin(), pow(), sqrt()?

734


What are pointer-to-members in C++? Give their syntax.

610