|
On Andreas Lagemann <andreas.lagemann@freenet.de> wrote:
[color=blue]
>
> Class Base
> {
> public:
> Base() {}
>
> Base(A* a, B* b);
>
> virtual A* foo(P* p, S& s); // using myA and myB[/color]
Make sure you have a virtual destructor, private copy constructor and
private assignment operator.
[color=blue]
> Executing this results in Base::foo being called instead of Der::foo[/color]
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.
[color=blue]
> (what I would expect) ....
> What am I doing wrong ?[/color]
Typo?
[color=blue]
> Is that because cstr of Der does not initialize any mebers of Base ?[/color]
Nope
Cheers Tim |