文档介绍:DELPHI8操作符重载的例子
unit WinForm;
interface
uses
, , ponentModel,
, ;
type
TWinForm = class()
{$REGION \'Designer Managed Code\'}
strict private
///
/// Required designer variable.
///
Components: ;
Button1: ;
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
procedure ponent;
procedure Button1_Click(sender: ; e: );
{$ENDREGION}
strict protected
///
/// Clean up any resources being used.
///
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
public
constructor Create;
end;
//写成类也可以,这里我用了记录。由于记录是值类型省去了创建实例的麻烦
TClassTest=record
public
FA:Integer;
//重载了“+”操作符
class operator add(A,B:TClassTest):TClassTest;
end;
[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]
implementation
{$REGION \'Windows Form Designer generated code\'}
///
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
///
procedure ;
begin
:= ;
;
//
// Button1
//
:= (96, 88);
:= \'Button1\';
:= (392, 112);
:= 0;
:= \'Button1\';
Include(, );
//
// TWinForm
//
:= (6, 14);
:= (560, 357);
();
:= \'TWinForm\';
:= \'WinForm\';
(False);
end;
{$ENDREGION}
procedure (Disposing: Boolean);
begin
if Disposing then
begin