"Ed Fair" <ed*****@mindspring.com> wrote in message
news:tc*******************@newsread1.news.atl.eart hlink.net...
Hi,
I am having a name collision between a library call and a class I've
created.
My class is called "socket", it abstracts a TCP socket.
In my constructors for my class, I am calling the socket library function
socket():
m_mySocket = socket(AF_INET,SOCK_STREAM,0)
My compiler is compaining "no overloaded function takes 3 parameters"
while clearly the socket library function does.
Is there a standard way to steer the compiler towards the correct
function?
TIA,
I would suggest that you follow the common convention for application code
and capitalise your class names, i.e. Socket. But if you don't want to do
that then you could use a namespace.
namespace networking
{
class socket
{
socket()
{
::socket(AF_INET,SOCK_STREAM,0);
}
};
}
The use of :: indicates that you want the socket library function, which is
in the global namespace, not your socket class (whose full name is
networking::socket).
john