Reputation: 3229
So I have a class that is defined as below:
class Socket {
public:
Socket();
virtual ~Socket();
int open();
void close();
private:
int mHandle;
int mState;
};
Then I implement the close() method as such:
void Socket::close()
{
if (mHandle!=0)
close(mHandle);
}
The "close(mHandle)" inside my close is the one defined in and AFAIK it is not within any namespace.
To workaround I renamed my close to something else, but there gotta be some other way...
Upvotes: 2
Views: 416
Reputation: 137940
Name lookup ends as soon as at least one function is found. You can qualify the name so it starts looking in the right place:
::close( mHandle );
Or declare the name locally so lookup bypasses the class members:
using ::close;
close( mHandle );
Upvotes: 4