I'm facing a problem that I think cannot be solved without some amount of code replication, but maybe I'm missing something.
This is my scenario:
TCommonAncestor = class (TSomeClass, ISomeInterface1, ISomeInterface2)
TAncestor1 = class (TCommonAncestor)
TAncestor2 = class (TCommonAncestor)
TMyClass1 = class (TAncestor1)
TMyClass2 = class (TAncestor2)
Given I can't modify nothing before TMyClass1/2 (the ancestors are Delphi classes, to be more specific I'm inheriting from FireDAC's Query/MemTable/StoredProc...), I need to implement a number of methods and properties common to all my inherited classes. Obviously the interface isn't a problem, I can create a new IMyInterface that declares all my new methods and properties, and modify my class declarations like this:
TMyClass1 = class (TAncestor1, IMyInterface)
TMyClass2 = class (TAncestor2, IMyInterface)
But then I must implement every method on every derived class...
Is there a way to avoid duplicate so much code?