接口 笔记
来源:互联网 发布:linux怎么修改配置文件 编辑:程序博客网 时间:2024/06/05 06:44
1.接口的继承者必须实现所有定义的接口函数或者方法
IMyInterface1 = interface(IInterface)
['{63E072DF-B81E-4734-B3CB-3C23C7FDA8EA}']
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
procedure ShowMSG;
end;
如果TMyInterface = class(TObject, IMyInterface1)
则在类TMyInterface 中许实现所有的QueryInterface,_AddRef,_Release,ShowMSG。
2.当继承多个接口的时候,如果有同样的函数名称,可以通过不同的名称进行区分
IMyInterface1 = interface(IInterface)
['{63E072DF-B81E-4734-B3CB-3C23C7FDA8EA}']
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
procedure ShowMSG;
end;
IMyInterface2 = interface(IInterface)
['{9DF6FD12-E8FB-4500-9E43-36C6E769F199}']
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
procedure ShowMSG;
end;
TMyInterface = class(TObject, IMyInterface1, IMyInterface2)
private
FRefCount: Integer;
FMsg: string;
public
procedure IMyInterface1.ShowMSG = ShowMSG1;
procedure IMyInterface2.ShowMSG = ShowMSG2;
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
function _Release: Integer; stdcall;
procedure ShowMSG1;
procedure ShowMSG2;
end;
- 接口 笔记
- Delphi 接口笔记
- 学习笔记:ServletContext接口
- Query接口学习笔记
- Hessian接口学习笔记
- java接口学习笔记
- 接口(笔记)
- Hessian接口学习笔记
- ISprite接口学习笔记
- Java接口学习笔记
- COM笔记-接口
- Java接口学习笔记
- Java接口学习笔记
- Java接口学习笔记
- Java接口学习笔记
- COM笔记-接口
- Java接口学习笔记
- JAVA笔记:接口
- AsyncTask对比Thread加Handler
- hd 3782 xxx定律
- hdu1864最大报销额
- 位运算
- iOS 键盘属性及退出几种方法(UITexfield 和 UITextView)
- 接口 笔记
- Java程序员应该掌握哪些技术?
- 解决Android SDK Manager更新、下载速度慢
- TabHost Tab的添加和删除
- MySQL修改密码方法总结
- Spinner的使用
- Vim报错E558: 在 terminfo 中找不到终端项 'gnome-256color'
- poj1141 Brackets Sequence 区间dp
- 快速排序用js、java和C的写法