[fpc-devel] Forward definitions of nested classes in outer scope

Willibald Krenn Willibald.Krenn at gmx.at
Sat Mar 12 20:18:30 CET 2011


Am 12.03.2011 17:51, schrieb Jonas Maebe:
> Hello,
>
> Could someone check whether or not this compiles with Delphi 2009+ ?

No, this does not compile on XE. However, you can do this:

   tforward = class;

   tc = class
    type
     tnest = class
     end;
   end;

   ty = class
     function f: tforward;
   end;

// let tforward be a class derived from tc.tnest
   tforward = class (tc.tnest);



You can also do this, of course:
   tc = class
    type
     tnest = class
     end;
   end;

   tforward = tc.tnest;

   ty = class
     function f: tforward;
   end;


Cheers,
  Willibald



More information about the fpc-devel mailing list