Hy All! :)
Hy All! :)
Is there any way to make a record helper for TPair?
For example:
type
TData = TPair;
TDataHelper = record helper for TData
// Error here: [DCC Error] something.pas(xx): E2086 Type 'TPair' is not yet completely defined
function IncValue: Integer;
end;
function TDataHelper.IncValue: Integer;
begin
Inc(Value);
Result := Value;
end;
Is there any way to make a record helper for TPair
For example:
type
TData = TPair
TDataHelper = record helper for TData
// Error here: [DCC Error] something.pas(xx): E2086 Type 'TPair
function IncValue: Integer;
end;
function TDataHelper.IncValue: Integer;
begin
Inc(Value);
Result := Value;
end;
IncValue() in error message and IncInteger() in code below? typo or mistake?
ReplyDeleteoh, IncValue is not in error msg :)
ReplyDeletetry to put TData and TDataHelper in different Type-sections, seems it works fine (at least in xe2);
ReplyDeletetype
TData = TPair;
type
TDataHelper = record helper for TData
end;
Thx, it was a typo, modified:
ReplyDeletefunction TDataHelper.IncInteger: Integer;
to
function TDataHelper.IncValue: Integer;
Andrew Terekhov Thank You, it works in XE too! :)
ReplyDeleteWhat is the difference in approach of the compiler, Marco Cantù ?
+1 to Andrew Terekhov answer, but who can desribe that? This is very strange.
ReplyDeleteI ran across this too when messing around in earlier Delphi versions. It's fixed in XE6 at least, perhaps earlier.
ReplyDelete