virtual function call from base of base
- by th3g0dr3d
hi,
let's say i have something like this (very simplified):
<pre><code>
class base
{
void invoke()
{
this-foo();
}
virtual void foo() = 0;
};
class FirstDerived : public base
{
void foo()
{
// do stuff
}
};
class SecondDerived : public FirstDerived
{
// other not related stuff
}
int main()
{
SecondDerived *a = new SecondDerived();
a-invoke();
}
What i see in the debugger is that base::invoke() is called and tries to call this-foo();
(i expect FirstDerived::foo() to be called), the debugger takes me to some unfamiliar
assembly code (probably because it jumped to unrelated areas) and after few lines i get
segmentation fault.
am i doing something wrong here? :/
thanks in advance