suppose A is a base class and B is the derved class. Both
have a method foo which is defined as a virtual method in
the base class. You have a pointer of classs B and you
typecast it to A. Now when you call pointer->foo, which
method gets called?
The next part of the question is, how does the compiler
know which method to call?
Answer Posted / nm
The answer is that B->foo gets calle, and why ? I found a
good explanation of that here:
http://en.wikipedia.org/wiki/Virtual_table
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What are the 5 oop principles?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
Why do we use inheritance?
How Do you Code Composition and Aggregation in C++ ?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What is the difference between static polymorphism and dynamic polymorphism?
can we make game by using c
What is polymorphism programming?
what type of questions
Why is destructor used?
Why do we use oops?
What are constructors in oop?
What is this pointer in oop?
#include
any one please tell me the purpose of operator overloading