C
charl
Unregistered / Unconfirmed
GUEST, unregistred user!
Eric Harmon的《Delphi COM深入编程》中有这么一个例子:
type
IFormattedNumber = interface
['{……}']
function FormattedString:string;
function GetName:string;
end;
TFormattedInteger = class(TInterfacedObject,IFormattedNumber)
private
FValue: Integer;
public
constructor Create(AValue: integer);
destructor Destroy;override;
function FormattedString:string;
function GetName:string;
end;
TFormattedHexInteger = class(TFormattedInteger,IFormattedNumber)
private
FValue: Integer;
public
destructor Destroy;override;
function FormattedString:string;
function GetName:string;
end;
FormattedString和GetName已经是TFormattedInteger类的公有方法了,它的子类TFormattedHexInteger再声明这两个方法是否应该加上override关键字?
谢谢!
type
IFormattedNumber = interface
['{……}']
function FormattedString:string;
function GetName:string;
end;
TFormattedInteger = class(TInterfacedObject,IFormattedNumber)
private
FValue: Integer;
public
constructor Create(AValue: integer);
destructor Destroy;override;
function FormattedString:string;
function GetName:string;
end;
TFormattedHexInteger = class(TFormattedInteger,IFormattedNumber)
private
FValue: Integer;
public
destructor Destroy;override;
function FormattedString:string;
function GetName:string;
end;
FormattedString和GetName已经是TFormattedInteger类的公有方法了,它的子类TFormattedHexInteger再声明这两个方法是否应该加上override关键字?
谢谢!