homework question on class...multiple choice

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2004
Posts: 7,783
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 745
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: homework question on class...multiple choice

 
0
  #11
Mar 24th, 2006
>if you look at my original question, i stated that
Yes, I read it, but thanks for the reminder anyway.

>the base class mem() is not virtual so dPtr -> mem(); will call Base::mem??
Seeing as how this is a variation of what I said:
Originally Posted by Narue
so dPtr->mem() will call Base::mem since mem isn't virtual.
It seems like you understand. The real type of dPtr is Base because it was declared as a pointer to Base. mem isn't a polymorphic function, and dPtr has no way of knowing that it actually points to an object of Derived. Therefore, Base::mem is used instead of Derived::mem.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 27
Reputation: jack223 is an unknown quantity at this point 
Solved Threads: 0
jack223 jack223 is offline Offline
Light Poster

Re: homework question on class...multiple choice

 
0
  #12
Mar 24th, 2006
Thanks for your help Narue...you have a great weekend.
thanks again.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC