我有一个简单的界面
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在实现接口的类中是不可见的!这是理想的行为还是我做错了什么?