I have a class B that inherits publicly from A:
class A {
private:
virtual void method();
}
class B : public A {
private:
void method();
}
Now, I need to somehow call the original A::method()
within B::method()
, without invoking the copy constructor for A.
A is defined in a library I'm trying to extend, so I can't change this code (make method protected for example). Is it possible to somehow cast the this
ptr within B::method()
and slice off the overridden method
?
I'm using an external interface that calls A::method()
. This interface correctly calls my overridden B::method()
, but I can't seem to make the interface call within B::method()
not generate a stack overflow.