how to scope a non-member function?

Okay, this is pretty simple but for some reason is escaping me today. I have a class which wraps some non-class library functions, and I want a couple of the methods (say "send()" and "receive()") to wrap library functions with the same names but different prototypes. How do I tell the compiler that these library functions are NOT supposed to be overloaded instances of the methods?
I'm not sure I understand your question.

A member function will never overload a global function because it needs an object.

Can you post some simple code that explains the problem?
Something like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// "send(...)" is a library function, not part of any class.  Its prototype is
// int send( HANDLE handle, char* buffer, size_t length );

class cMyThing
{
private:
    HANDLE handle;
public:
    public int send( char* buffer, size_t length );    // this one is a method
};

...

// method implementation
int cMyThing::send( char* buffer, size_t length )
{
    return send( this->handle, buffer, length );    // COMPILE ERROR
}


I just thought of something... is this where I would prefix the function name inside the method with "::" without a class name?
Ah, yes, that's exactly what the scope operator is for:

1
2
3
4
int cMyThing::send( char* buffer, size_t length )
{
    return ::send( this->handle, buffer, length );
}


The :: with nothing to the left indicates you want to call a global 'send' function.
Thank you, I guess I can mark this as solved.
Topic archived. No new replies allowed.