【发布时间】:2015-02-04 14:17:07
【问题描述】:
我想为 Integer 和 string 类型绑定类型 T:
interface
type
MyFactory<T> = class
public
function createGenerator<T:Integer,string>:IGenerator<T>;
end;
但是编译器给出:'(..) E2510 Type 'Integer' is not a valid constraint'。如何将类型 T 限制为整数或字符串?或者这是因为我使用的是序数类型而导致的问题?
【问题讨论】:
标签: delphi generics delphi-xe7