Create C++ Class with "Default/Main" Value (ie 'string')
so i wondering on how you 开发者_如何学JAVAcreate a class in c++ where the object itself has a main value like how 'string' works
for example:
MySocket m = SOCKET kSocket;
m.Connect(...);
SOCKET aSocket = m;
where m has a default type of SOCKET but has other variables and functions
It is late.. so I am going to make a big leap here.
I think you are looking for auto type converters. There isn't a default type. What you are looking for is a way to automatically type convert a m
into a SOCKET
.
look up using something like
class MySocket
{
public:
operator SOCKET()
{
SOCKET socket;
socket.handle = _handle;
return socket;
}
};
精彩评论