Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 a class oop?

1021


to find out the minimum of two integer number of two different classes using friend function

2149


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1863


What are the 5 oop principles?

1132


What is object in oop?

1124


What is difference between oop and pop?

1178


Can destructor be overloaded?

1042


What is inheritance in simple words?

1063


What are the types of abstraction?

1082


What are main features of oop?

1126


What are oops methods?

1023


What are the benefits of oop?

1266


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1644


What is the diamond problem in inheritance?

1147


What is property in oops?

1073