Delphi 介面:兩個介面有相同名稱的方法
阿新 • • 發佈:2019-01-10
假設有兩個介面定義,裡面有相同名稱的方法。然後有一個類,要同時實現這兩個介面。語法上該怎麼寫才正確?
請看程式碼:
type IMyIntfA = interface ['{03A9D09A-F6C7-42BA-9C01-D3F9A43F3AFB}'] function Hello(const S: string): string; end; IMyIntfB = interface ['{C2EDFFEA-95B1-43B8-9C9D-28E32A48FAE7}'] function Hello(const S: string): string; end; TForm2 = class(TForm, IMyIntfA, IMyIntfB) private { Private declarations } public function HelloA(const S: string): string; function HelloB(const S: string): string; function IMyIntfA.Hello = HelloA; function IMyIntfB.Hello = HelloB; end;