PDA

View Full Version : QList<QNetworkCookie> cookies = cookie->allCookies(); into Variable



TJSonic
11th March 2010, 20:39
Hello. Im trying to write all cookies to the variable and getting an error.
My code


QList<QNetworkCookie> cookies = cookie->allCookies();


error code

D:/my14/../Qt/2010.01-win/qt/include/QtNetwork/../../src/network/access/qnetworkcookiejar.h:69: error: 'QList<QNetworkCookie> QNetworkCookieJar::allCookies() const' is protected


What does it mean "protected"???Seems i cant write in variable...
Documentation says that this function is used for writing cookies in file......
Help please...

wysota
11th March 2010, 21:46
http://msdn.microsoft.com/en-us/library/e761de5s.aspx
http://en.wikibooks.org/wiki/C++_Programming/Classes#protected

Svenny
6th October 2010, 22:09
... or without reading manuals (but you really should read it): you can use protected methods ONLY INSIDE the class (or inherited classes). That means, that if you want to use it outside, you have to overload it or write another public method to access it. Like this:


class MyCookieJar : public QNetworkCookieJar
{
public:
getAllCookies() { return allCookies(); }
};