Re: call derived method from base class
I've not run your code on my machine, but the reason should be that the Base dtor is invoked after the Derived1 dtor. Therefore, the call to go() does not invoke Derived1::go. The same thing happens in the opposit direction when you try to invoke a virtual function in the ctor of the base. Indeed, try declaring Base1::go as pure virtual: you should see a pure virtual call exception in that case.
EDIT: FYI, note that if you changed the code to something like
Code:
int main(int argc, char** argv){
Derived1* der = new Derived1();
der->start();
std::cin.get();
delete der;
return 0;
}
it will appear to "work" again, because it's highly probable that go() gets invoked before der is deleted.
Re: call derived method from base class
ok thanks all for your help,
and thanks superbonzo, it's just as you said