class sock {
public:
SOCKET m_hSock;
.....
//Other functons...contructors, destructors
.....
operator SOCKET()
{ return m_hSock;}
}
在上述socket类代码中,它重载了哪个运算符?
class sock {
public:
SOCKET m_hSock;
.....
//Other functons...contructors, destructors
.....
operator SOCKET()
{ return m_hSock;}
}
operator Type()
其中Type是所需类型,通常被称为强制转换运算符,可以用于强制转换操作,如static_cast<Type>(obj)