| | |
homework question on class...multiple choice
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
>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:
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.
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.
I'm here to prove you wrong.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Tiffiney Needs Help!! PLEASE! WITH C++
- Next Thread: Can you help my hw???
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






