Is there a way to call the static member function override B::baz()
from the base class member function A::foo()
?
class A
{
public:
virtual void foo() { bar(); baz(); }
virtual void bar() { std::cout << "A::bar()" << std::endl; };
static void baz() { std::cout << "A::baz()" << std::endl; }
};
class B : public A
{
public:
void bar() override { std::cout << "B::bar()" << std::endl; };
static void baz() { std::cout << "B::baz()" << std::endl; }
};
The output of
B b;
b.foo();
is
> B::bar()
> A::baz()
so A::baz()
is called in A::foo()
.