Answer Posted / deepa balamurugan
If the both Base and the Derived class having the same
function then the Base class funtion should be declared as
virtual function. Then the C++ determines which function to
be called at the runtime based on the type of the object
pointed to by the Base pointer rather than the type of the
pointer.
As soon as the compiler reads the keyword virtual ,it will
create the vtable contains the address of the virtual
function inside that class and as soon as vtable is
created ,vptr is initialized to the proper vtable.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How can a called function determine the number of arguments that have been passed to it?
Is there a c++ certification?
How is data hiding achieved in c++?
Explain what is class definition in c++ ?
Define private, protected and public access control.
Describe new operator?
Why was c++ made?
What are the general quetions are in DEna bank manager IT/System interviews?
Write a program to find the Fibonacci series recursively.
how to connect with oracle 9i with server in socket program in c/c++
How can I learn dev c++ programming?
What is helper in c++?
Write a Program to find the largest of 4 no using macros.
Is string data type in c++?
What is the use of default constructor?