test::run是作者遗留下来的垃圾吗
#include <stdio.h>
class test
{
public:
virtual void run() = 0;
virtual void prerun();
};
inline void test::run()
{
printf("test::fun()\n");
prerun();
}
void test::prerun()
{
run();
//some code here
}
class test_impl : public test
{
public:
virtual void run()
{
printf("test_impl::run()\n");
}
};
int main()
{
test *t = new test_impl();
t->prerun();
delete t;
return 0;
}