Define an interface: IDoSomething with three method signatures.
Then change the class declaration to
TMyCheckBox = class(TCheckBox, IDoSomething)
and then do it.
If the implementations are general or very close.
Then define the helper class TDoSomething and then delegate the work.
eg.
Procedure TMyCheckBox.DoSomething1; // implements IDoSomething1 Begin TDoSomething.DoSomething1(Self); // given class method will suffice. End;
Class methods in delphi, equivalent to static methods in other languages.
Type TDoSomethingHelper = Class(TObject) Public Class Procedure DoSomething1(aComponent : TComponent); End; ... implementation Class Procedure TDoSomethingHelper.DoSomething1(aComponent : TComponent); Begin aComponent.Tag = 27; End;
source share