关于定义接口的create方法
如题,我想给接口定义一个create构造方法,
如下一段代码
type
Imy=interface
procedure Create(a:string);
end
Tmy=class(TInterfacedObject,Imy)
public
procedure Create(a:string);
end;
..
..
procedure TMy.Create(a:string);
begin
...
end;
...
var my:IMy;
..
my := TMy.create('abc'); '这句编译通不过,提示This form of method call only allowed for class methods;
..
想请教大家,如果我要在类中实现接口中定义的构造函数,该怎么办啊,网上关于接口的资料好少。感谢感谢