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 / suchi

It depends the pointer points to the object of which class.
If the pointer points to Class A, then the method defined
in class A will be called, and if the pointer points to
class B, then the method defined in class B will be called.

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction example?

1042


Write a c++ program to display pass and fail for three student using static member function

3326


What is the difference between abstraction and polymorphism?

1048


What are the three main types of variables?

1062


What are the components of marker interface?

996


What is the difference between procedural programming and oops?

1059


Why do we use encapsulation in oops?

970


Can an interface inherit a class?

1010


What is static modifier?

1127


Why multiple inheritance is not possible?

1018


write a programe to calculate the simple intrest and compund intrest using by function overlading

2130


Why do we use class?

1026


What is oops in simple words?

1033


Why do we use class in oops?

914


Is html an oop?

1000