Another doubt about the Delphi interface: How can it be automated?

xiaoxiao2021-03-06  37

Too inexplicable, recently being maded by Delphi's interface, please see the following code (pay attention to the black body and red): Type Iinterface1 = interface end; tclass1 = class (TinterfacedObject, IINTERFACE1) deStructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor Destructor DESTROY; OVERRIDE; END;

TForm1 = class (TForm) Button1: TButton; procedure FormCreate (Sender: TObject); procedure Button1Click (Sender: TObject); private {Private declarations} class1: IInterface1; // Note that this is the interface IInterface1, not a class TClass1, TClass1 no The public {public declarations} end; importation {tclass1} declass1} designation {tclass1} dethation {tclass1} dethation {tclass1} dethation {tclass1} designation {tclass1} dethation {tclass1} designation; inherited; end;

Procedure TFORM1.FORMCREATE (Sender: TOBJECT); Begin Class1: = Tclass1.create;

Procedure TForm1.Button1Click (Sender: TOBJECT); Begin Class1: = nil; // is here, he will automatically jump to DESTROY. // If Class1 is class Tclass1, it will not jump to DESTROY. / / Why? why? END;

转载请注明原文地址:https://www.9cbs.com/read-69979.html

New Post(0)