【发布时间】:2013-02-04 10:36:18
【问题描述】:
我有一个简单的界面
ISomeProperties = interface
['{3AD52E4E-5190-4ABE-8AFC-062295E3A352}']
function GetPort: integer;
procedure SetPort(const Port: integer);
end;
GetFunction 和 SetFunction 在代码完成中可见。但是在我添加这样的属性之后
ISomeProperties = interface
['{3AD52E4E-5190-4ABE-8AFC-062295E3A352}']
function GetPort: integer;
procedure SetPort(const Port: integer);
property Port: integer read GetPort write SetPort;
end;
GetPort 和 SetPort 方法消失,只有属性 Port 可见 - 很棒。
现在我实现了一个接口
TSomeProperties = class(TInterfacedObject, ISomeProperties)
private
function GetPort: integer;
procedure SetPort(const Port: integer);
end;
但是属性 Port 在实现接口的类中是不可见的!这是理想的行为还是我做错了什么?
【问题讨论】:
-
声明属性不会使方法不可见。
-
@DavidHeffernan 是的,对不起,我的错误。在代码完成中不可见。是这样还是我的 Delphi 愚弄了我?
标签: delphi oop interface delphi-7