When overriding a C++ virtual method, is there a way to invoke the base class method without specifying the exact base class name, in a similar way that we can do it in C# with the "base" keyword? I am aware that this could be in conflict with multiple inheritance, but I wonder if more modern versions of C++ have introduced such a possibility. What I want to do is something like this:
class A { public: virtual void paint() { // draw something common to all subclasses } }; class B : public A { public: virtual void paint() override { BASE::paint(); // draw something specific to class B } }; I know that in B::paint() we can call A::paint(), I just want to know if there is a more "generic" way to call the base method without referring explicitly to class A. Thank you in advance. Andrea
std::direct_basealong with a type alias. Maybe soon (TM).__super. Otherwise, this is a relevant read: stackoverflow.com/questions/180601/using-super-in-c