var
t:TFrmMain;
begin
if(self is TForm) then
begin
if(self.ClassType=tform) then
begin
ShowMessage('tform');
end
else if(self.classtype=TFrmMain) then
begin
ShowMessage('tform1');
end;
end;
end;
delphi中的is运算符可以判断对象是否继承自某一个类,classtype可以判断具体是哪个类。
本文介绍了在Delphi中如何使用is运算符判断对象是否继承自特定类,以及通过ClassType属性来精确判断对象的具体类型。
584

被折叠的 条评论
为什么被折叠?



