Class unit
The unit Un_Class;
Interface
USES System. Classes, Un_Interface;
Type
TTest=class (TInterfacedObject ITest)
Public
The function getdate (value: string) : string; The phrase ";
The function getvalue: string; The phrase ";
end;
Implementation
{TTest}
Function TTest. Getdate (value: string) : string;
The begin
Result: the value=
end;
The function TTest. Getvalue: string;
The begin
Result:='FFFFF';
end;
End.
Interface unit
The unit Un_Interface;
Interface
USES the System. The Classes;
Type
ITest=interface (IInterface)
[' {4 d2 f3260eb - 99-47 be e4-89-7 d8862cb05f7} ']
The function getdate (value: string) : string;
The function getvalue: string;
end;
Implementation
End.
Finally, in the main window called
USES Un_Interface;
Procedure TForm1. Button1Click (Sender: TObject);
Var aa: ITest;
The begin
ShowMessage (aa) getvalue);
end;
Execution will address mistakes, could you tell me how the whole?
CodePudding user response:
Must first create the object, and then assigned to the interface variables,USES Un_Class Un_Interface;
Procedure TForm1. Button1Click (Sender: TObject);
Var aa: ITest;
The begin
Aa:=TTest. Create;
ShowMessage (aa) getvalue);
end;