📄 usayhello.pas
字号:
unit uSayHello;
interface
type
IGreetable= interface
['{D91DDE09-0FC4-4FE9-AE0D-9877E2F73BF6}']
function SayHello:string;
end;
TMan = class (TInterfacedObject)
Language: string;
Married: Boolean;
Name: string;
SkinColor: string;
public
constructor create;virtual;
end;
TChinese = class (TMan,IGreetable)
public
constructor create;override;
private
function SayHello:string;
end;
TAmerican = class (TMan,IGreetable)
public
constructor create;override;
private
function SayHello:string;
end;
TFrench = class (TMan,IGreetable)
public
constructor create;override;
private
function SayHello:string;
end;
TKorean = class (TMan,IGreetable)
public
constructor create;override;
private
function SayHello:string;
end;
implementation
constructor TMan.create;
begin
Name:='张三';
Language:='中文';
SkinColor:='黄色';
end;
constructor TChinese.create;
begin
inherited;
end;
constructor TAmerican.create;
begin
Name:='Lee';
Language:='英文';
SkinColor:='黑色';
end;
constructor TFrench.create;
begin
Name:='苏菲';
Language:='法文';
SkinColor:='白色';
end;
constructor TKorean.create;
begin
Name:='金知中';
Language:='韩文';
SkinColor:='黄色';
end;
function TChinese.SayHello;
begin
Result:='chinese.bmp';
end;
function TAmerican.SayHello;
begin
Result:='American.bmp';
end;
function TFrench.SayHello;
begin
Result:='French.bmp';
end;
function TKorean.SayHello;
begin
Result:='Korean.bmp';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -