按顺序写出下面代码的输出 (设 __PRETTY_FUNCTION__ 在 virtual void fun() 输出为
virtual void Base::fun(),)
class Base {
public:
virtual void fun() { cout << __PRETTY_FUNCTION__ <<
endl; }
void fun2() { cout << __PRETTY_FUNCTION__ << endl;
}
virtual ~Base() { cout << __PRETTY_FUNCTION__ <<
endl; };
};
class Derived : public Base {
public:
void fun() { cout << __PRETTY_FUNCTION__ << endl;
}
void fun2() { cout << __PRETTY_FUNCTION__ << endl;
}
~Derived() { cout << __PRETTY_FUNCTION__ << endl;
};
};
int main() {
Base *a = new Base;
Base *b = new Derived;
a->fun();
b->fun();
a->fun2();
b->fun2();
delete a;
delete b;
return 0;
}