回复 3楼 八画小子
我这就是从C++语言环境里看到的一个自定义类:
//TransmitSignals.h
class TransmitSignals : public QObject
{
Q_OBJECT
public:
static TransmitSignals &GetInstance();
private:
TransmitSignals();
~TransmitSignals();
TransmitSignals(const TransmitSignals &) = delete ; ← //编译器报语法错误
TransmitSignals(const TransmitSignals &&) = delete; ← //编译器报语法错误
TransmitSignals &operator=(const TransmitSignals &) = delete;
← //编译器报语法错误
signals:
void mid_signal_1();
void mid_signal_2(int state);
void mid_signal_3();
public slots:
};
//TransmitSignals.cpp
#include "TransmitSignals.h"
TransmitSignals &TransmitSignals::GetInstance()
{
static TransmitSignals RobotControl;
return RobotControl;
}
TransmitSignals::TransmitSignals()
{
}
TransmitSignals::~TransmitSignals()
{
}
这个类有构造函数和析构函数的定义。 出错就是 = delete 的用法。编写这个自定义类的作者,把“= delete”用在了2个复制构造函数和一个操作符重载函数上,究尽要表达一个什么意义?而且这种表达编译器也通不过。问题出在哪呢?