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 makes a language oop?

590


Why is oop useful?

593


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1570


Why do while loop is used?

568


Do you know about multiple inheritance?

634






Why is abstraction needed?

560


Is abstract thinking intelligence?

586


What is the difference between encapsulation and polymorphism?

582


What is difference between multiple inheritance and multilevel inheritance?

596


write knight tour problem which is present in datastructure

2156


Who invented oop?

645


What is abstraction encapsulation?

648


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2567


Which is better struts or spring?

612


Get me an image implementation program.

1554