Einzelnen Beitrag anzeigen

Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.025 Beiträge
 
Delphi 12 Athens
 
#11

AW: Fehlende Mehrfachvererbung bei Schnittstellen

  Alt 17. Jul 2014, 21:31
Jetzt mal etwas out-of-the-box gedacht (weiß nicht, ob das hier taugt):

Delphi-Quellcode:
type
  IBase = interface
  end;

  ISub1 = interface (IBase)
  end;

  ISub2 = interface (IBase)
  end;

  IBoth = interface
    function GetSub1: ISub1;
    function GetSub2: ISub2;
    property Sub1: ISub1 read GetSub1;
    property Sub2: ISub2 read GetSub2;
  end;

type
  TFluxKompensator = class(TInterfacedObject, ISub1, ISub2, IBoth)
    function GetSub1: ISub1;
    function GetSub2: ISub2;
  end;

function TFluxKompensator.GetSub1: ISub1;
begin
  result := Self;
end;

function TFluxKompensator.GetSub2: ISub2;
begin
  result := Self;
end;
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat