How can I call a base class method which is overridden by the derived class, from a derived class object?
class Base{ public: void foo(){cout<<\"
Consider making foo() virtual in the first place.
foo()
class Base { public: virtual ~Base() = default; virtual void foo() { … } }; class Derived : public Base { public: virtual void foo() override { … } };
However, this does the job:
int main() { Derived bar; bar.Base::foo(); return 0; }