TRemotable 的子类的 published 属性必须是读写的

2 views
Skip to first unread message

电脑玩家

unread,
Oct 11, 2009, 5:22:32 AM10/11/09
to 挨踢技术
TMyRm = class(TRemotable)
private
FMyString: string;
published
property MyString: string read FMyString;
end;

如果一个类写成上面的模式,也就是只读,没有 write 部分,则:

1. 实现一个接口函数,比如: GetMyStr: TMyRM;,在服务器端创建对象并返回,没问题;
2. 在客户端调用这个函数获得这个对象,执行调用函数的方法的时候,会出现 AV 错误。

结论:这里不能写只读的属性。必须写 read write 读写属性。

Reply all
Reply to author
Forward
0 new messages