Just remembered, FPC also supports macros - see
http://www.freepascal.org/docs-html/prog/progse5.html
I haven't tested it, but you should be able to do
{$MACRO On}
{$DEFINE aClassBObject:=TClassB(FClassBObject) }
and then use aClassBObject instead of the coercion.
On 15/04/16 11:13, Tony Whyman wrote:
In the end though this is just a "what's in a name? A rose by any
other name would smell as sweet" debate. No matter how you approach
the problem, you have to have an identifier for the other class when
you reference its methods and properties. If you don't want to declare
two mutually referential classes in the same unit, then one of them
(but only one) has to use some technique to avoid circular references.
Type casting is a simple technique and you either have to coerce each
use (think of TClassB(FObject) as just being a longer name for the
same thing) or declare an alias of the correct type - a "With"
statement can also be your friend here.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal