Hi Sven,

2013/9/23 Xiangrong Fang <xrf...@gmail.com>

>  Short answer: you can't. The same would happen with normal classes.
>>
>> Long answer: You could add an additional method "Next" to your "TIntTree"
>> which returns a "TIntTree" and just do "Result := TIntTree(inherited
>> Next);" there.
>>
> I still have problem with this strange issue.   See the demo program below:

program test;
{$mode objfpc}{$H+}
uses treap;
type
  TStringMapper = class(specialize TTreap<string, string>)
  end;
var
  sm1, sm2: TStringMapper;
  n: TStringMapper.PNode;
begin
  sm1 := TStringMapper.Create;
  for n in sm1.Reversed do WriteLn(n^.Key);   <-- but NOT here
  sm2 := sm1.Reversed;                        <-- error here
end.

Why is this?  Also, I found that the keyword "specialize" is recognized in
fpc mode, but "class" is only valid in objfpc mode, is that correct?

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

Reply via email to