📄 sealedandfinal.dpr
字号:
program SealedAndFinal;
uses
System.Windows.Forms,
Borland.Delphi.SysUtils;
var
aForm: Form;
type
TBase = class
procedure A; virtual;
end;
TDeriv1 = class (TBase)
procedure A; override; {final;}
end {sealed};
// uncomment "sealed" and you'll get the error:
// "cannot extend sealed class TDeriv1"
// uncomment "final" and you'll get the error:
// "cannot override a final method"
TDeriv2 = class (TDeriv1)
procedure A; override;
end;
{ TBase }
procedure TBase.A;
begin
end;
{ TDeriv2 }
procedure TDeriv2.A;
begin
inherited;
end;
{ TDeriv1 }
procedure TDeriv1.A;
begin
inherited;
end;
begin
aForm := Form.Create;
aForm.Text := 'Hello, Delphi';
Application.Run (aForm);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -