var
ff:TIniFile;
begin
if Assigned(ff) then
ShowMessage('Fuck');
else
ShowMessage('Fool');
end;代码输出是什么?没有实例化的类变量用Assigned函数会返回True吗?谢谢!
ff:TIniFile;
begin
if Assigned(ff) then
ShowMessage('Fuck');
else
ShowMessage('Fool');
end;代码输出是什么?没有实例化的类变量用Assigned函数会返回True吗?谢谢!
Assigned can't detect a dangling pointer--that is, one that isn't nil but no longer points to valid data. For example, in the code example for Assigned, Assigned won't detect the fact that P isn't valid.
因为程序中多个地方要到一个变量,而使用这个变量的时候并不知道它是否被实例化,所以要判断,但是用Assigned好像在这里不能达到我的预期,怎么办哦?
';' not allowed before 'ELSE'