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
Why is destructor used?
What is an interface in oop?
What does it mean when someone says I oop?
What is abstraction in oops with example?
What is static in oop?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is class and object in oops?
Can you explain polymorphism?
Why do pointers exist?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
Why we use classes in oop?
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
What is the main purpose of inheritance law?
What is multilevel inheritance?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...