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


Please Help Members By Posting Answers For Below Questions

What is the full form of oops?

616


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

2150


When not to use object oriented programming?

572


Can we create object of abstract class?

581


What do you mean by overloading?

586






any one please tell me the purpose of operator overloading

1967


What is polymorphism and types?

605


What is the purpose of polymorphism?

683


What are different oops concepts?

579


Is this job good for future? can do this job post grduate student?

1694


What are two types of polymorphism?

615


How to improve object oriented design skills?

572


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1672


What is advantage of inheritance?

693


how to get the oracle certification? send me the answer

1672