Hey,

I have a bit of a problem. I have a class that uses C libraries to make a TCP connection, which is accomplished with the connect() function. Now, I'd like to use this class in a Qt program and make it inherit QObject. The problem is, since I need signals and slots, I inherit the connect() function from QObject, which overrides the C function, therefore causing problems while compiling.

So, is there a way to make an explicit call to the "TCP" connect()?

Qualify it with the name of the TCP base class: MyTCPBaseClassName::connect()

Qualify it with the name of the TCP base class: MyTCPBaseClassName::connect()

Ehm, how do you do that, exactly, with C libraries?

I have a class that uses C libraries to make a TCP connection

I assumed that this meant that you had a wrapper for your C functions. If not, can you modify the TCP class?

I assumed that this meant that you had a wrapper for your C functions. If not, can you modify the TCP class?

No, I don't have a wrapper class for the C functions. I copied some code I've made some time ago to a C++ class "StatusConnection" which inherits QObject. The "StatusConnection" tries to establish the TCP connection in the constructor part.

Sorry, I had misread your initial post. Hmm. Well, since the C code belongs to you, is there anything stopping you from doing a search and replace on it. I imagine there is a way to do what you want but I'm not sure what it is.

Sorry, I had misread your initial post. Hmm. Well, since the C code belongs to you, is there anything stopping you from doing a search and replace on it. I imagine there is a way to do what you want but I'm not sure what it is.

Ehm, I don't have the original C code of the function, it's in the sys/types.h and sys/socket.h libraries. I only call the function, but it happens to be of the same name as the QObject's connect(). What I need is a workaround to be able to distinguish these two functions so I can call them both from the same class.

Let's see if anyone else has some insight as to whether this is possible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.