Reputation:
class sock {
public:
SOCKET m_hSock;
.....
//Other functons...contructors, destructors
.....
operator SOCKET()
{ return m_hSock;}
}
In above coscket class code, what operator it is overloading?
Upvotes: 3
Views: 81
Reputation: 30624
This is known as the type cast operator. Operators of the form;
operator Type()
where Type is the desired type, are generally known as cast operators and can be used in casting operations, such as static_cast<Type>(obj)
Upvotes: 5