Is there any way to print the class name of a derived class with an inherited function without overriding that function in the derived class?
class A {
public:
virtual void print() { printf("%s", __PRETTY_FUNCTION__); }
};
class B : public A {};
int main() {
B b;
b.print() // should yield "B::print()" but yields "A::print()"
}
I'm asking so that I can just call up A::print() in an overridden function to print the attributes related to the parent class, but include the current class name.