Q
QianQi
Unregistered / Unconfirmed
GUEST, unregistred user!
求赐教以下几种声明方式的区别和哪种是错误的:
1.unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyDataType=Record
Name:String;
Amount:Real;
Items:Integer;
Paid:Boolean;
end;
TMyDataObject=Class(TObject)
private
MyData:TMyDataType;
published
Constructor Create(Name:String);
Destructor Free;
Procedure SetRecord(var Rec:TMyDataType);
Procedure GetRecord(var Rec:TMyDataType);
end;
type
MyComponent=Class(TComponent)
private
FRecord:TMyDataType;
published
Property TheRecord:TMyDataType Read FRecord Write FRecord;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
end.
2.unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyDataType=Record
Name:String;
Amount:Real;
Items:Integer;
Paid:Boolean;
end;
TMyDataObject=Class(TObject)
MyComponent=Class(TComponent)
private
MyData:TMyDataType;
FRecord:TMyDataType;
published
Constructor Create(Name:String);
Destructor Free;
Procedure SetRecord(var Rec:TMyDataType);
Procedure GetRecord(var Rec:TMyDataType);
Property TheRecord:TMyDataType Read FRecord Write FRecord;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
end.
3.unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyDataType=Record
Name:String;
Amount:Real;
Items:Integer;
Paid:Boolean;
end;
type
TMyDataObject=Class(TObject)
MyComponent=Class(TComponent)
TForm1 = class(TForm)
private
{ Private declarations }
MyData:TMyDataType;
FRecord:TMyDataType;
public
{ Public declarations }
published
Constructor Create(Name:String);
Destructor Free;
Procedure SetRecord(var Rec:TMyDataType);
Procedure GetRecord(var Rec:TMyDataType);
Property TheRecord:TMyDataType Read FRecord Write FRecord;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
end.
4.unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyDataType=Record
Name:String;
Amount:Real;
Items:Integer;
Paid:Boolean;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
type
TMyDataObject=Class(TObject)
MyComponent=Class(TComponent)
private
MyData:TMyDataType;
FRecord:TMyDataType;
published
Constructor Create(Name:String);
Destructor Free;
Procedure SetRecord(var Rec:TMyDataType);
Procedure GetRecord(var Rec:TMyDataType);
Property TheRecord:TMyDataType Read FRecord Write FRecord;
end;
{$R *.DFM}
end.
5.unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMyDataType=Record
Name:String;
Amount:Real;
Items:Integer;
Paid:Boolean;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
type
TMyDataObject=Class(TObject)
MyComponent=Class(TComponent)
private
MyData:TMyDataType;
FRecord:TMyDataType;
published
Constructor Create(Name:String);
Destructor Free;
Procedure SetRecord(var Rec:TMyDataType);
Procedure GetRecord(var Rec:TMyDataType);
Property TheRecord:TMyDataType Read FRecord Write FRecord;
end;
end.