You simply cant do it. Not even multiple inheritance would help you in this case.
You will have to extend each class by hand. Multiple inheritance would allow you to join back branches in the class hierarchy, but in this case you want to add the same functionality to multiple branches, but keep the branches separate entities. This is impossible with current freepascal OOP and i dont think this is even a good thing to have. It could be done multi-class helper, kind of class helper that works on multiple classes. But i dont even know of a language that has such possibility (i dont know much languages anyway). 2012/5/18 Zaher Dirkey <[email protected]>: > > On Fri, May 18, 2012 at 11:27 PM, Bernd <[email protected]> wrote: >> >> >> _B3 = class(T_A); >> How about this: >> >> T_A = class(TObject); >> >> T_AX = class(T_A); // <-- this class implements your extensions >> >> T_B1 = class(T_AX); // TB_1 and >> T_B2 = class(T_AX); // TB_2 inherit it >> T_B3 = class(T_A); >> >> > > I can't, in fact it is my mistak when i explained. > > B1 B2 is in the base unit like as A, i cant modify it, very strict. > > My projects is db layer, i have TmyCustomField, > TmyFields=class(TmyCustomField) and TmyParams=class(TmyCustomField), that in > the base unit. > > now i like to inherit both TmyFields and TmyParams to add functions work on > Firebird, TmyFirebirdFields and TmyFirebirdParams, both have same functions > to work on buffer SQLDA. > > Best Regards > Zaher Dirkey > > > _______________________________________________ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
