On 19.05.2012 16:28, Zaher Dirkey wrote:
On Sat, May 19, 2012 at 2:10 AM, Jorge Aldo G. de F. Junior
<jagf...@gmail.com <mailto:jagf...@gmail.com>> wrote:
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.
I have no Idea about "multiple inheritance".
I am thinking now if i can assign a helper to more than one class by
make base helper, then inherit it for every class B1 and B2.
I will try and post a feedback.
Yes, you can do that basically:
type
T_AHelper = class helper for T_A
end;
T_B1Helper = class helper(T_AHelper) for T_B1
end;
T_B2Helper = class helper(T_AHelper) for T_B2
end;
Please not that the extended classes (in this case T_B1 and T_B2) need
to inherited from T_A, otherwise the compiler will complain.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal