D
downlder
Unregistered / Unconfirmed
GUEST, unregistred user!
用对象没有什么问题,
var
a: TAnimal;
b: TBird;
begin
.....
if a is TBird then
(a as TBird).Fly;
end;
接口就不行了
var
a: IAnimal;
b: IBird;
begin
.....
if Supports(a, IBird, b) then
//if a is IBird then
b.Fly;
end;
var
a: TAnimal;
b: TBird;
begin
.....
if a is TBird then
(a as TBird).Fly;
end;
接口就不行了
var
a: IAnimal;
b: IBird;
begin
.....
if Supports(a, IBird, b) then
//if a is IBird then
b.Fly;
end;