My primary goal is to use SOLID principles while switching to Delphi language.
Let suppose I have a parent class Parent
that I unfortunately can't edit or modify (e.g. part of the delphi library, hidden in private code..).
Parent = class;
And a child class, that I want to improve, by implementing an OOP interface ("interface" or "pure abstract class", used indistinctively from now on):
INiceInterface = interface
procedure HelloWorld;
end;
Child = class(Parent, INiceInterface)
procedure HelloWorld; override;
end;
When trying to do this, the compiler complains about:
E2291 Missing implementation of interface method INiceInterface._AddRef E2291 Missing implementation of interface method INiceInterface._Release E2291 Missing implementation of interface method INiceInterface.QueryInterface
Looking for those errors, I found the following text exploring solutions, with a quite negative conclusion: https://www.codeproject.com/Articles/1252175/Fixing-Delphis-Interface-Limitations
Considering that OOP is a quite mature concept, much older than Delphi, I am positively convinced that I am missing something, and that such a basic feature must be available in Delphi.
How to properly apply inverse dependency in Delphi? [ enfasis multiple interfaces ]