我試着去建立一個全球性的類,所以我可以在任何地方訪問它,但它不工作,我得到的錯誤:全局類++
a storage class can only be specified for objects and functions
有誰知道我要去哪裏錯了嗎?
這裏是我的.h文件:
extern class Payments : public QObject
{
Q_OBJECT
public:
Payments(QObject *parent = 0);
virtual ~Payments();
void purchase(const QString &id, const QString &sku, const QString &name, const QString &metadata);
void getExisting(bool refresh);
void getPrice(const QString &id, const QString &sku);
public slots:
void purchaseResponse();
void existingPurchasesResponse();
void priceResponse();
signals:
void purchaseResponseSuccess(const QString &receiptString);
void existingPurchasesResponseSuccess(const QString &receiptsString);
void priceResponseSuccess(const QString &price);
void infoResponseError(int errorCode, const QString &errorText);
private:
bb::platform::PaymentManager *paymentManager;
};
'public slots:'和'signals:'是什麼?從未看過之前的語法... – 0x499602D2
Qt語法來實現觀察者模式。 – Morwenn
@David:它特定於QT並通過預編譯器進行轉換。 –