I`m getting the following error in my code(line 65):
error: expected constructor, destructor, or type conversion before ‘*’ token
namespace SocketSpace {
class Error {
public:
Error(const std::string& msg = 0) throw();
const char* what() throw();
~Error() throw();
private:
std::string message_m;
};
class Socket {
public:
void setPort(unsigned short port) throw(Error);
std::string showUser() throw(Error);
std::string showForeignUser() throw(Error);
protected:
int desc_m;
Socket(int newID) throw(Error);
Socket(int type, int protocol) throw(Error);
private:
Socket(const Socket&);
Socket& operator = (const Socket&);
};
class ComSocket: public Socket {
public:
void connect(const std::string& adress, unsigned short port) throw(Error);
void send(std::string& buffer) throw(Error);
int recv(std::string& buffer) throw(Error);
protected:
ComSocket(int type, int protocol) throw(Error);
ComSocket(int newID) throw(Error);
};
class TCPSocket: public ComSocket{
public:
TCPSocket() throw(Error);
TCPSocket(const std::string& adress, unsigned short port) throw(Error);
private:
friend class ServerSocket;
TCPSocket(int newID) throw(Error);
};
class ServerSocket: public Socket {
public:
ServerSocket(unsigned short port) throw(Error);
TCPSocket* accept() throw(Error);
private:
void setListen(int n) throw(Error);
};
}
.........................................................................................
SocketSpace::Socket::Socket(int newID) throw(Error)
{
this->desc_m = newID;
}
........................................................................................
SocketSpace::ComSocket::ComSocket(int newID) throw(Error): Socket(newID) {}
.......................................................................................
SocketSpace::TCPSocket::TCPSocket(int newID) throw(Error): ComSocket(newID) {}
.......................................................................................
TCPSocket* SocketSpace::ServerSocket::accept() throw(Error)
{
int ret = 0;
if((ret = ::accept(desc_m, 0, 0)) < 0)
{
throw("Error accepting socket");
}
return new TCPSocket(ret);
}
Any help ?