I have the following structure... Three controls made by me, that inherit from the same common control TCustomControl
.
TDriveBar [MyShell.pas] > TCustomPanel [Vcl.ExtCtrls.pas] > TCustomControl [Vcl.Controls.pas]...
TPathBar [MyShell.pas] > TCustomControl [Vcl.Controls.pas]...
TFileList [MyShell.pas] > TCustomSuperList [MySuperList.pas] > TCustomControl [Vcl.Controls.pas]...
Now, I would like to change something so that my TDriveBar
, TPathBar
and TFileList
can be accessed (typecast) as a common ancestor class and have some new methods in common. That ancestor seems to be TCustomControl
, but I don't know if it's possible to insert a new class there. Even more, I would prefer that TCustomSuperList
not to contain those new methods when it's used alone. I don't know if I made myself understood...
I cannot use interfaces because the idea is to write the common methods only once and use them in those thre controls... With an interface, I have to implement it in every Shell control...
question from:https://stackoverflow.com/questions/65946949/adding-some-common-methods-to-different-classes