I want to create an Interfaced object that supports an Interface from somewhere else + my own functions. So, how to stack/aggregate/enhance the Interface? I guess its possible, but I cant find a snippet or demo specific for my inheritance experiment.
This solution is not quite what I want:
TImplement = Class(TInterfacedObject, IOne, ITwo)
private
FOne: IOne;
public
property One: IOne read FOne implements IOne;
property Two: ITwo read FTwo implements ITwo;
end;
Current usage:
(MyInterface as IOne).Something;
(MyInterface as ITwo).SomethingElse;
Desired usage:
MyInterface.Something;
MyInterface.SomethingElse;
I tried inheriting the Interface:
ITogether = Interface(IOne)
procedure SomeThingElse;
end:
TImplement = Class(TInterfacedObject, ITogether)
// or Class(TInterfacedObject, ITogether, IOne) => Both result in missing Implementation message on compile ...
private
FOne: IOne;
function SomeThingElse;
public
property One: IOne read FOne implements IOne;
end;
This combination says something like:
E2291 Implementation of Method x From Interface IOne missing.
Is it possible to combine the Interface in a way so that the "cast free" calls are possible?
Edit: Rob Lambden´s answer is for me the missing Information. Uwe Raabes Answer is the Correct implementation. (And probably the only one possible) So uwe wins the answer and i can only upvote Robs answer.