我正在尝试使用 QOAuth 但收到以下错误:
错误:'QOAuth::Interface& QOAuth::Interface::operator=(const QOAuth::Interface&)' 是私有(private)的
我的源码如下:
服务.h
// ...
class Service : public QObject
{
Q_OBJECT
// ...
private:
QOAuth::Interface *qoauth;
};
// ...
服务.cpp
#include "service.h"
Service::Service(QObject *parent) :
QObject(parent)
{
*qoauth = new QOAuth::Interface;
}
QString Service::getAuthorizeUrl(QString consumerKey, QString consumerSecret){
// set the consumer key and secret
qoauth->setConsumerKey(consumerKey);
qoauth->setConsumerSecret(bytes);
// ...
}
void Service::accessToken(QString url) {
// send a request to exchange Request Token for an Access Token
QOAuth::ParamMap reply = qoauth->accessToken(url, QOAuth::POST, m_token, m_tokenSecret, QOAuth::HMAC_SHA1);
// ...
}
我对指针的理解不够,这可能是原因...
提前致谢。
最佳答案
*qoauth = new QOAuth::Interface;
不正确,因为 new
返回一个指针 指向它应该是 的对象qoauth = new QOAuth::Interface;
关于c++ - 'QOAuth::Interface& QOAuth::Interface::operator=(const QOAuth::Interface&)' 是私有(private)的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9376874/