What are the fields of vtable
Answer / 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 |
what is object slicing
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; a.x = 22; int c = a.x; int *b = new int; cout << c; return 0; } option: No output 0 22 -(11) Will not compile
What is the default size allocated for array in the statement if size not specified " int a[] "
Why is abstraction used?
What do you mean by pure virtual functions?
how to find no of instances of an object in .NET?
How compiler selects(internally) required overridden function in inheritance?
2 Answers CSC, Infinite Computer Solutions,
what is costructor?
What is abstraction in oop?
ambiguity regulation of multiple inheritance with example.
What do you mean by Encapsulation?
what is overloading and overriding?