【发布时间】:2016-03-12 05:03:43
【问题描述】:
我写了一个简单的测试如下:
#include <QCoreApplication>
#include <QObject>
class Foo : public QObject
{
Q_OBJECT
};
class foo1
{
};
int main(int argc, char* argv[])
{
QCoreApplication a(argc, argv);
Foo f;
return a.exec();
}
这给了我一个错误:
错误:未定义对 `vtable for Foo' 的引用:
但是,当我将 Foo f 更改为 Foo f() 时,它没有任何错误。
所以我的问题是f 和f() 有什么区别?
【问题讨论】: