![]() |
calling virtual function results in calling function of base class ...
On Andreas Lagemann <andreas.lagemann@freenet.de> wrote:
> > Class Base > { > public: > Base() {} > > Base(A* a, B* b); > > virtual A* foo(P* p, S& s); // using myA and myB Make sure you have a virtual destructor, private copy constructor and private assignment operator. > Executing this results in Base::foo being called instead of Der::foo Did you make a typo or something. It will call Der::foo if your foo signature is exact the same in Der. Are you sure you use pointers when you are passing the Der object as a Base object? To make sure use private copy constructor and private assignment operator so you will not lose the Der object info when copying the object. > (what I would expect) .... > What am I doing wrong ? Typo? > Is that because cstr of Der does not initialize any mebers of Base ? Nope Cheers Tim |
| All times are GMT. The time now is 04:29 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.