Advertisement
Guest User

TUnicorn

a guest
Mar 29th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.97 KB | None | 0 0
  1. program TypeClass;
  2.  
  3. uses
  4.   Unicorn;
  5.  
  6. var
  7.   Twilight: TUnicorn;
  8.  
  9. begin
  10.   Twilight := TUnicorn.Create('Twilight');
  11.   Twilight.Free;
  12. end.
  13.  
  14. {...}
  15.  
  16. unit Pony;
  17.  
  18. interface
  19.  
  20. type
  21.   TPony = class(TObject)
  22.   protected
  23.     FName: AnsiString;
  24.   public
  25.     constructor Create(constref AName: AnsiString);
  26.     destructor Destroy(); override;
  27.     procedure IntroduceSelf(); virtual; abstract;
  28.     procedure Walk(); virtual; abstract;
  29.   published
  30.     property Name: AnsiString read FName;
  31.   end;
  32.  
  33. implementation
  34.  
  35. constructor TPony.Create(constref AName: AnsiString);
  36. begin
  37.   FName := AName;
  38. end;
  39.  
  40. destructor TPony.Destroy();
  41. begin
  42.   inherited Destroy();
  43. end;
  44.  
  45. end.
  46.  
  47. {...}
  48.  
  49. unit Unicorn;
  50.  
  51. interface
  52.  
  53. uses
  54.   Pony;
  55.  
  56. type
  57.   TUnicorn = class(TPony)
  58.   public
  59.     procedure IntroduceSelf(); override;
  60.     procedure Walk(); override;
  61.   end;
  62.  
  63. implementation
  64.  
  65. procedure TUnicorn.IntroduceSelf();
  66. begin
  67. end;
  68.  
  69. procedure TUnicorn.Walk();
  70. begin
  71. end;
  72.  
  73. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement