C++ ';QOAuth::接口&;QOAuth::Interface::operator=(const QOAuth::Interface&;)和#x27;是私人的
我正在尝试使用QOAuth,但收到以下错误: 错误:“QOAuth::Interface&QOAuth::Interface::operator=(const QOAuth::Interface&)”是私有的 我的源代码如下: 服务.hC++ ';QOAuth::接口&;QOAuth::Interface::operator=(const QOAuth::Interface&;)和#x27;是私人的,c++,qt,C++,Qt,我正在尝试使用QOAuth,但收到以下错误: 错误:“QOAuth::Interface&QOAuth::Interface::operator=(const QOAuth::Interface&)”是私有的 我的源代码如下: 服务.h // ... class Service : public QObject { Q_OBJECT // ... private: QOAuth::Interface *qoauth; }; // ... service.cpp #inclu
// ...
class Service : public QObject
{
Q_OBJECT
// ...
private:
QOAuth::Interface *qoauth;
};
// ...
service.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=newqoauth::Interface
不正确,因为new
返回指向它应该是的对象的指针qoauth=new qoauth::Interface代码>谢谢您,很抱歉回复太晚。我尝试了qoauth=new qoauth::Interface
,然后编译器抱怨,例如qoauth->setConsumerKey(consumerKey),“->”的基操作数具有非指针类型“qoauth::Interface”代码>如果我更改它,点运算符和编译器会说“没有匹配的函数用于调用'QOAuth::Interface::setConsumerKey(QString&')”。哪个是正确的。。。?