Problems creating a new class
Howdy,
I'm working on a web server in C++ at the moment, and I'm having a slight problem (read on even if you don't know anything about web servers, the problems not with that).
I have created a class called Connection, which stores data on every request made while it is handled. When a new request is made, I want to create a new Connection, and delete it once the request is finished processing.
This is what I wrote:
Code:
Connection * newRequest(SockFD) = new Connection;
The argument the default constructor takes is the socket descriptor, but dont worry about that. When I have:
Code:
Connection newRequest(SockFD);
It all runs fine.
The error I get is:
Cannot convert 'int' to 'Connection *'
Declaration syntax error.
Any help on this is greatly appreciated, I know its a silly mistake I've made, but I can't see it. Thanks :)
PS: The class's constructor that I made takes an argument (SockFD in this case, which is an int). There is no second constructor which takes no arguments. Does this make any difference?