Hello All,

I have a unit here:

https://github.com/xrfang/pastats/blob/master/src/units/datalist.pas

which report this error:

/home/xrfang/git/pastats/src/units/datalist.pas(61,17) Warning: An
inherited method is hidden by "constructor TDataFrame.Create;"

However, the following code, which also define a new constructor without
using "overload", does NOT have such warning.

program Project1;
{$mode objfpc}{$H+}
type
  TBase = class
  public
    constructor Create(AName: string);
  end;
  TDerived = class(TBase)
  public
    constructor Create;
  end;

constructor TDerived.Create;
begin
  WriteLn('Creator of TDerived... anonymous');
end;

constructor TBase.Create(AName: string);
begin
  WriteLn('Creator of TBase: ', AName);
end;

var
  obj: TDerived;
begin
  obj := TDerived.Create;
end.

If I use reintroduce, I can suppress this warning. But my question is, why
is this warning NOT displayed in the above sample code? In general, shall I
use "reintroduce" keyword? Is it related to generics?

Thanks!

Xiangrong
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to