home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / D / NICER.ZIP / UTAnoKid.pas < prev    next >
Pascal/Delphi Source File  |  1997-02-05  |  2KB  |  106 lines

  1. {UTAnoKid.pas}
  2. {$X+ extended syntax}
  3. unit Utanokid;
  4.  
  5. INTERFACE
  6. uses
  7.     Classes,
  8.     UTAnothe;
  9.  
  10. type
  11.     TAnotherKid = class( TAnother )
  12.         constructor Create(const aString: string; const aDouble: double);
  13.         constructor Clone(const aTAnotherKid: TAnotherKid);
  14.         constructor Get(S: TStream);
  15.         constructor Read(var f: Textfile);
  16.  
  17.         destructor Destroy; override;
  18.  
  19.         procedure Copy(const aTAnotherKid: TAnotherKid);
  20.         function Equals(const aTAnotherKid: TAnotherKid): boolean;
  21.         procedure Put(S: TStream);
  22.         procedure Write(var f: Textfile);
  23.  
  24.         function GetD: double;
  25.         function SetD(const aDouble: double): double;
  26.  
  27.     private
  28.         d: double;
  29.     end;  {TAnotherKid}
  30.  
  31. {]====================================================[}
  32.  
  33.                                          IMPLEMENTATION
  34.  
  35. uses
  36.     SysUtils;
  37.  
  38.  
  39. constructor TAnotherKid.Create(const aString: string; const aDouble: double);
  40. begin
  41.     inherited Create(aString);
  42.     d := aDouble;
  43. end;  {Create}
  44.  
  45. constructor TAnotherKid.Clone(const aTAnotherKid: TAnotherKid);
  46. begin
  47.     inherited Clone(aTAnotherKid);
  48.     d := aTAnotherKid.d;
  49. end;  {Clone}
  50.  
  51. constructor TAnotherKid.Get(S: TStream);
  52. begin
  53.     inherited Get(S);
  54.     S.Read(d,sizeof(d));
  55. end;  {Get}
  56.  
  57. constructor TAnotherKid.Read(var f: Textfile);
  58. begin
  59.     // to be added
  60. end;  {Read}
  61.  
  62. destructor TAnotherKid.Destroy;  {override}
  63. begin
  64.     inherited Destroy;
  65. end;  {Destroy}
  66.  
  67. procedure TAnotherKid.Copy(const aTAnotherKid: TAnotherKid);
  68. begin
  69.     if Self = aTAnotherKid then Exit;  {don't clobber self}
  70.     inherited Copy(aTAnotherKid);
  71.     d := aTAnotherKid.d;
  72. end;  {Copy}
  73.  
  74. function TAnotherKid.Equals(const aTAnotherKid: TAnotherKid): boolean;
  75. begin
  76.     Result := true;
  77.     if Self = aTAnotherKid then Exit;  {saves time?}
  78.     Result := Result and TAnother(Self).Equals(TAnother(aTAnotherKid));
  79.     Result := Result and (d = aTAnotherKid.d);
  80. end;  {Equals}
  81.  
  82. procedure TAnotherKid.Put(S: TStream);
  83. begin
  84.     inherited Put(S);
  85.     S.Write(d,sizeof(d));
  86. end;  {Put}
  87.  
  88. procedure TAnotherKid.Write(var f: Textfile);
  89. begin
  90. end;  {Write}
  91.  
  92. function TAnotherKid.GetD: double;
  93. begin
  94.     Result := d;
  95. end; {GetD}
  96.  
  97. function TAnotherKid.SetD(const aDouble: double): double;
  98. begin
  99.     Result := d;
  100.     d := aDouble;
  101. end; {SetD}
  102.  
  103. {initialization}
  104. {finalization}
  105. end. {UTAnoKid.pas}
  106.