[fpc-pascal] Problem with multiple inheritance

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Nov 2 17:45:03 CET 2006


I was trying to split the o-o wrappers around Qt procedural wrappers
in 2 parts. One that depends on Lazarus and another that can be used
with only Free Pascal.

So I have some classes like this:

TQtWidget = class(TObject)

TQtFrame = class(TQtWidget)

Both classes contain mixed code for accessing Qt functions and
procedures specific for Lazarus, like Event loops, methods that
receive lazarus classes, methods to receive event signals, etc.

So I would now have, after splitting:

For pure Qt:

TQtWidget = class(TObject)

TQtFrame = class(TQtWidget)

And for laz parts:

TLazQtWidget = class(TObject)

TLazQtFrame = class(TLazQtWidget, TQtFrame)

The problem is that on TLazQtFrame I would like to inherit all
functions from a normal TQtFrame, but I would also like to inherit all
functions from TLazQtWidget.

How can I work around this? I mean, how can I redesign my idea to make
it work with FP?

Note that Qt requires that all methods to receive events, and signals
be from objects (I cannot use a procedure to receive events).

Felipe Monteiro de Carvalho

More information about the fpc-pascal mailing list