【发布时间】:2011-11-22 14:39:35
【问题描述】:
我正在尝试做这样的事情:
function CreateIfForm ( const nClass : TClass ) : TForm;
begin
if not ( nClass is TFormClass ) then
raise Exception.Create( 'Not a form class' );
Result := ( nClass as TFormClass ).Create( Application );
end;
这会产生错误“运算符不适用于此操作数类型”。 我正在使用 Delphi 7。
【问题讨论】:
-
别忘了接受答案 ;-)