#include <iostream>
using namespace std;
struct foo
{
// virtual ~foo() {};
};
struct bar : foo
{
};
int main( void )
{
foo a;
bar b;
foo& c = b;
cout << typeid(a).name() << endl;
cout << typeid(b).name() << endl;
cout << typeid(c).name() << endl;
return 0;
}
运行结果
struct foo
struct bar
struct foo
去掉注释,运行结果
struct foo
struct bar
struct bar
为什么???