【发布时间】:2015-12-11 14:11:39
【问题描述】:
是否可以有两个同名的属性?
property Cell [Cl, Rw: Integer]: string read getCell write setCell;
property Cell [ColName: string; Rw: Integer]: string read getCellByCol write setCellByCol;
好吧,我试过了,编译器不让我这样做,但也许有一个技巧......?
【问题讨论】:
-
'overload' 也无济于事......
-
您可以坚持使用带有
variant或TField之类的参数的方法,您可以在其中确定方法本身中实际传递的类型。 -
它是可能的 - 有点。看我的回答...
-
我强烈建议您将接受的答案更改为@HeartWare 的答案
-
您可以为 Column 定义一条记录,其中包含字符串和整数的隐式类运算符来实现此目的。
property Cell[Column:ColumnRec; Row: Integer]
标签: delphi delphi-xe7