Здравствуйте.
Не работает перегрузка функций.
Пример.
Всё время вызывается перегруженная функция TBase.Create(Value: LongWord), вне зависимости от передаваемого параметра
в Delphi 10.4.2 Sydney, в Delphi 7 всё работает корректно, т.е. в зависимости от передаваемого параметра вызывается соответствующая перегруженная функция.
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | TTypeFunc = function : LongWord of object ;
TBase= class
protected
fFuncValue: TTypeFunc;
fValue: LongWord ;
public
constructor Create (Func: TTypeFunc); overload;
constructor Create (Value: LongWord ); overload;
end ;
TForm1 = class (TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
fBaseProp: TBase;
function getValue: LongWord ;
public
end ;
constructor TBase . Create(Func:TTypeFunc);
begin
fFuncValue := Func;
fValue := 0 ;
end ;
constructor TBase . Create(Value: LongWord );
begin
fFuncValue := nil ;
fValue := Value;
end ;
procedure TForm1 . Button1Click(Sender: TObject);
begin
fBitProp := TBase . Create(getDParams);
end ;
|
Админ: Пользуемся тегами при оформлении кода!