<分区>
我写了一个简单的测试如下:
#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();
}
这给了我一个错误:
error: undefined reference to `vtable for Foo':
但是,当我将 Foo f
更改为 Foo f()
时,它没有任何错误地符合要求。
所以我的问题是 f
和 f()
有什么区别?