PDA

View Full Version : Transparent QLocalSocket and QTcpSocket use



chiiph
12th November 2010, 16:35
Hello everyone...

I'm implementing an interface to another application that can be done through QLocalSocket or QTcpSocket, and the user can opt for any of those.

So the idea is this:
I have a parent class A, that is an abstract ancestor of both specific classes.
Class B that uses a QLocalSocket and inherits from A.
Class C that uses QTcpSocket and inherits from A.

The problem is that the first common ancestor of both specific classes is QIODevice, and it has a lot of pure virtual members.
So for example, I have several methods that do exactly the same in both B and C, but since they use at least one of these pure virtual methods I have to duplicate code in B and C instead of implementing them in A and inherit.

Any ideas how can I solve this?

Thanks in advance