Socket has a constructor that takes a winsock SOCKET as parameter and stores it in a private variable:
Socket::Socket(SOCKET s) { this->s = s; }
I’m trying to make a class ‘GameSocket’ that will parse data from my Socket class:
class GameSocket : public Socket { protected: void ParseData(unsigned char* data, int size); };
Next to these classes, I have a ‘Server’ class that creates new sockets when needed:
GameSocket* Server::Accept() { SOCKET a = accept(s, 0, 0); if(a==SOCKET_ERROR) { return 0; } else { return new GameSocket(a); } }
However, this gives me an error on the last ‘else’:
error C2664: 'GameSocket::GameSocket' : cannot convert parameter 1 from 'SOCKET' to 'const GameSocket &'
I must be missing something with constructors when dealing with derived classes…
Don’t go too hard on me, I’m relatively new to C++ and OOP
Add in a constructor for GameSocket