Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program TypeClass;
- uses
- Unicorn;
- var
- Twilight: TUnicorn;
- begin
- Twilight := TUnicorn.Create('Twilight');
- Twilight.Free;
- end.
- {...}
- unit Pony;
- interface
- type
- TPony = class(TObject)
- protected
- FName: AnsiString;
- public
- constructor Create(constref AName: AnsiString);
- destructor Destroy(); override;
- procedure IntroduceSelf(); virtual; abstract;
- procedure Walk(); virtual; abstract;
- published
- property Name: AnsiString read FName;
- end;
- implementation
- constructor TPony.Create(constref AName: AnsiString);
- begin
- FName := AName;
- end;
- destructor TPony.Destroy();
- begin
- inherited Destroy();
- end;
- end.
- {...}
- unit Unicorn;
- interface
- uses
- Pony;
- type
- TUnicorn = class(TPony)
- public
- procedure IntroduceSelf(); override;
- procedure Walk(); override;
- end;
- implementation
- procedure TUnicorn.IntroduceSelf();
- begin
- end;
- procedure TUnicorn.Walk();
- begin
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement