Вниз
Скачать: CL | DM;

Интерфейсы и reinroduce   Найти похожие ветки 

 
mfender ©   (2006-10-10 15:42) [0]

Есть два класса:

 
 TmfXMLLogMemo = class(TCustomMemo, ImfXMLLogMemo)
 public
   procedure Log(Data: string); virtual;
 end;

 TmfXMLExtLog = class(TmfXMLLogMemo, ImfXMLExtLog)
 public
   procedure Log(Data: string; RecType: string); reintroduce;
 end;


И их интерфейсы:


 ImfXMLLogMemo = interface(IInterface)
 ["{985E3293-E06B-41EA-B28D-091FEA31804F}"]
   procedure Log(Data: string);
 end;

 ImfXMLExtLog = interface(ImfXMLLogMemo)
 ["{07656F85-3E51-48E6-A4E8-6B5F0238B047}"]
   procedure Log(Data: string; RecType: string);
 end;


Как сделать так, чтобы компилятор не ругался "Declaration of "Log" differs from declaration in interface "ImfXMLExtLog""? Объявить метод в интерфейсе (reintroduce) так же как в реализации пытался. В ответ получил "Unknown dirrective "reintroduce""... Что я опять не правильно делаю?


 
mfender ©   (2006-10-10 16:04) [1]

Ларчик просто открывался:


TmfXMLExtLog = class(TmfXMLLogMemo, ImfXMLExtLog)
public
  procedure Log(Data: string; RecType: string); overload;
end;


 
guav ©   (2006-10-10 16:05) [2]

  TmfXMLExtLog = class(TmfXMLLogMemo, ImfXMLExtLog)
  public
    procedure ImfXMLExtLog.Log = ExtLog;
    procedure ExtLog(Data: string; RecType: string);
  end;


 
mfender ©   (2006-10-10 16:18) [3]


> guav ©   (10.10.06 16:05) [2]

Классно! Спасибо! Даже не знал, что такое чудо можно в Delphi провернуть.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.029 c
1-1158675326
buzz
2006-09-19 18:15
2006.10.29
Загадка для знатоков VCL


2-1160666423
i-am-vladko
2006-10-12 19:20
2006.10.29
потоки...


2-1160395203
mahab
2006-10-09 16:00
2006.10.29
WM_VSCROLL


3-1157436969
Itonix
2006-09-05 10:16
2006.10.29
удаление Fields из ibQuery


15-1159123421
Andy BitOff
2006-09-24 22:43
2006.10.29
Швейцарцы создали 160-мегапиксельную камеру




   Наверх