1
0
lazarus-tutorials/polymorphic class/person.pas

61 lines
920 B
ObjectPascal
Raw Permalink Normal View History

2021-10-05 15:33:01 -04:00
unit person;
{$mode objfpc}{$H+}
interface
uses Dialogs;
type
2021-10-08 13:28:36 -04:00
TPerson = class
procedure Speak; virtual; abstract;
end;
2021-10-05 15:33:01 -04:00
{TBeckham}
TBeckham = class(TPerson)
procedure Speak; override;
end;
{TShakespeare}
TShakespeare = class(TPerson)
procedure Speak; override;
end;
{TWest}
TWest = class(TPerson)
procedure Speak; override;
end;
{TBlaise}
TBlaise = class(TPerson)
procedure Speak; override;
end;
implementation
{TBlaise}
procedure TBlaise.Speak;
begin
ShowMessage('Le coeur a ses raisons que la raison ne connait point');
end;
{TWest}
procedure TWest.Speak;
begin
ShowMessage('I used to be Snow White... but I drifted');
end;
{TShakespeare}
procedure TShakespeare.Speak;
begin
ShowMessage('The robbed that smiles steals something from the thief');
end;
{TBeckham}
procedure TBeckham.Speak;
begin
ShowMessage('I''ve got more clothes than Victoria!');
end;
end.