mixing objective-c and c++
I'm trying to write a class in c++ that needs to implement some objective-c methods. I read here, that it's possible: http://www.mactech.com/articles/mactech/Vol.13/13.03/CandObjectiveCCompared/ (at the end of the document)
However, I get this error: 'error: expected unqualified-id before '-' token' at this line
+- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response+
Here's the url_connection.h
#ifndef URL_CONNECTIONH
#define URL_CONNECTIONH
#include "debug.h"
class URL_Connection
{
private:
NSData *receivedData;
NSURL *url;
NSURLRequest *theRequest;
NSURLConnection *theConnection;
public:
URL_Connection();
~URL_Connection();
};
+- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response+
{
// this method is called when the server has determined that it
// has enough information to create the NSURLResponse
// it can be called multiple times, for example in the case of a
// redirect, so each time we reset the data.
// receivedData is declared as a method instance elsewhere
[receivedData setLength:0];
}
#endif
I really have no ideea how to fix this and couldn't find something similar on the web. What am I doing wrong?
Please advice,
Thanks