#include <iostream>
class Base
{
public:
Base()
{
func();
}
~Base()
{
func();
}
virtual void func()
{
std::cout << "Base func" << std::endl;
}
};
class Work
{
public:
virtual void func()
{
std::cout << "Work func" << std::endl;
}
};
int main()
{
Base base;
return 0;
}
$ ./a.out
Base func
Base func
标签:std,函数,Base,构建,func,时机
From: https://www.cnblogs.com/zhangxuechao/p/16593604.html