【发布时间】:2014-10-29 08:14:20
【问题描述】:
type
TGeneric<T> = class(TBase)
public
procedure Swap(Harry : T);
procedure NotifyAll(AParams : T);
end;
我有两个问题
-
有什么方法可以将泛型变量类型转换为任何其他类型,例如变体等。
-
如何在函数中传递泛型类型,像这里一样接受 const 数组
Delphi - How can I pass Generic parameter to function that accept Array of const parameter
【问题讨论】:
-
嗨约翰,理想情况下你会问两个问题
-
这两个问题都是相关的,所以我在这里没有单独问他们。
-
您已经将答案链接到问题 2 还是我在这里遗漏了什么?
-
什么是泛型变量?你能给我们一些示例代码吗?
-
TGeneric
= class (tbase) public procedure Swap(harry : T);程序 NotifyAll( AParams : T);结尾;这里 harry 是可以接受任何类型的泛型变量
标签: delphi generics delphi-xe4