[fpc-devel] Circular references and forward declarations

Juha Manninen juha.manninen at phnet.fi
Wed Jan 6 11:09:11 CET 2010

On keskiviikko, 6. tammikuuta 2010 03:08:35 Nikolai ZHUBR wrote:
> Tuesday, January 05, 2010, 11:08:37 PM, Juha Manninen wrote:
> > On tiistai, 5. tammikuuta 2010 20:06:42 Florian Klaempfl wrote:
> >> Then do the same as in C++ and put it in different include files.
> >
> > Right, include files could solve this problem at least partly. They seem
> > to be
> Curious enough, nobody even mentioned interfaced objects (interfaces),
> though they are available in both FPC and Delphi since ages.
> Not that I would recommend this seriously, however here goes:

I have tried that, too, but it doesn't solve the problem in real cases either.
The problem are data members, not methods. You sometimes need to access data 
between dependent classes and with interface you then define Get... and Set... 
methods for them. That is little too much if you just want to avoid circular 
Abstract base class is little better because you can define at least part of 
the data there.
Still, best solution has been to put everything into one big file. And still, 
I don't like that compiler forces such a thing.

Juha Manninen

More information about the fpc-devel mailing list