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
Can a varargs method be overloaded?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
What is oops with example?
What is abstraction in oops with example?
Can a destructor be called directly?
What are the 4 pillars of oop?
Whats oop mean?
What does and I oop and sksksk mean?
How do you achieve runtime polymorphism?
What is an interface in oop?
Why do while loop is used?
Why is polymorphism used?
What is the purpose of enum?
What is the difference between static polymorphism and dynamic polymorphism?
Get me an image implementation program.