我继承CAsyncSocket得到新的类如下:
class CNewSocket : public CAsyncSocket
{
public:
CNewSocket();
virtual ~CNewSocket();
CNewSocket(const   CNewSocket&   objectSrc); 
void   operator=(const   CNewSocket&   objectSrc);
         void OnReceive(int nErrorCode);
void OnSend(int nErrorCode);
public:
int m_nLength;
};
用到CNewSocket的地方是
void CListenSocket::OnAccept(int nErrorCode)
{
CNewSocket* pSocket = new CNewSocket();
if (Accept(*pSocket))
{
pSocket->AsyncSelect(FD_READ);
m_pSocket = pSocket;
}
else
delete pSocket;
CAsyncSocket::OnAccept(nErrorCode);
}
现在老是出现以下错误
1>d:\my documents\visual studio 2008\projects\mfcsockets\mfcsockets\newsocket.h(17) : error C2248: 'CAsyncSocket::CAsyncSocket' : cannot access private member declared in class 'CAsyncSocket'
1>        d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxsock.h(104) : see declaration of 'CAsyncSocket::CAsyncSocket'
1>        d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxsock.h(100) : see declaration of 'CAsyncSocket'
1>        This diagnostic occurred in the compiler generated function 'CNewSocket::CNewSocket(const CNewSocket &)'请大家帮忙看看,谢谢~~