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 is coupling in oops?
write knight tour problem which is present in datastructure
i got a backdoor offer in process global,Bangalore..Can i work with it?
What is abstraction and encapsulation?
What is an example of genetic polymorphism?
Can you inherit a private class?
what's the basic's in dot net
Write a program to sort the number with different sorts in one program ??
Explain the advantages of inheritance.
What does oop mean in snapchat?
What does <> mean pseudocode?
What is this pointer in oop?
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
Which type does string inherit from?
What is multilevel inheritance in oop?