class cSocket
{
private:
SOCKET sock;
public:
// A few methods here...
void closeSocket()
{
shutdown(sock);
closesocket(sock);
}
};
Now in my app some where...
cSocket sock1;
cSocket sock2;
// Initialize sock1 here and connect
sock2 = sock1; // <-- Make a copy...
// Do stuff here...
sock2.closeSocket();
Will sock2.closeSocket close the socket and free the resources correctly?