1
0
lazarus-tutorials/polymorphic class/person.pas
2021-10-08 13:28:36 -04:00

61 lines
920 B
ObjectPascal

unit person;
{$mode objfpc}{$H+}
interface
uses Dialogs;
type
TPerson = class
procedure Speak; virtual; abstract;
end;
{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.