R
Raider
I have class hierarchy with virtual methods like this:
class Base
{
public:
virtual void Show();
~Base();
};
class Derived : public Base
{
public:
virtual void Show();
void DoDerivedStuff();
~Base();
};
And I have a function dealing with Derived objects:
void foo(Derived& d)
{
d.DoDerivedStuff();
d.Show(); // <- but here I want to call Base::Show(),
// not Derived::Show()
// (or even DerivedDerived::Show())
}
What should I write to call Base::Show() in foo()?
Should I write special adaptor like this
void Derived::BaseShow()
{
Base::Show();
}
and call it? Or may be there is a simpler way?
class Base
{
public:
virtual void Show();
~Base();
};
class Derived : public Base
{
public:
virtual void Show();
void DoDerivedStuff();
~Base();
};
And I have a function dealing with Derived objects:
void foo(Derived& d)
{
d.DoDerivedStuff();
d.Show(); // <- but here I want to call Base::Show(),
// not Derived::Show()
// (or even DerivedDerived::Show())
}
What should I write to call Base::Show() in foo()?
Should I write special adaptor like this
void Derived::BaseShow()
{
Base::Show();
}
and call it? Or may be there is a simpler way?