Good idea, from what I understand of interfaces that should work without the
circular reference problem.

Thanks!

I'm going to take the time to refigure my unit reference structure anymay
because this problem has pointed it out as being a mess. :(

Nahum

-----Original Message-----
From: Dennis Chuah [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 August 1999 13:51
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Circular unit references - gotta love'm!



Or you can use interfaces ...

unit A;
interface
type
  IMyVeryOwn = interface;

  TMyOtherClass =
     FMyVeryOwnClass: IMyVeryOwn;

unit B;

  TImpMyVeryOwn = class (TInterfacedObject, IMyVeryOwn)


> Not elegant but this might work for you.
> In the first unit define an abstract class for one oth the objects.
> Put as much or as little functionallity in here as you like.
> In the second unit inherit from the abstract class and put 
> the rest of the
> functionallity in.
> -------------------------------------
> UNIT A:
> interface
> TMyVeryOwnAbstractClass = Class(whatever);
> 
> TMyOtherClass = ...
>   fMyVeryOwnClass : TMyVeryOwnAbstractClass;
> ...
> implementation
> uses unitB;
>  TMyVeryOwnClass(fMyVeryOwnClass)....
> -------------------------------------
> UNIT B:
> interface
> uses Unit A
> TMyVeryOwnClass = class(TMyVeryOwnAbstractClass)
> ....
> implementation
> ....
> -------------------------------------
> 
> Wes Edwards
> CommSoft Group Ltd
> PO Box 691, Shortland Street
> Auckland 1015, New Zealand
> Phone: +64 9 358 5900
> Fax:     +64 9 358 5901
> Support+64 9 358 5902
> Sales   +64 9 358 5903
> Email:   [EMAIL PROTECTED]
> 
> SmartCharge ... On Every Switch
> www.smartcharge.com
> 
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Nahum Wild
> > Sent: Thursday, 19 August 1999 08:42
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: Circular unit references - gotta love'm!
> >
> >
> > Does anyone know how to get around the following issue where
> > I have two
> > different classes that each contain a reference to the 
> other in their
> > definition, the problem being that I want them in different
> > units.   As
> > predicted delphi spits a 'circular reference' error at me. :s(
> >
> > Sticking them both in the same unit is not really an option.
> >
> > I know you can declare in a unit what classes are defined in
> > it like so:
> > TMyVeryOwnClass = class;
> > Meaning the the classes defined in that unit can reference 
> each other
> > without worrying about their physical order in the unit.  Is
> > there such a
> > thing project wide? or am I just clutching at straws?
> >
> >
> >
> > Thanks.
> >
> >
> > Nahum Wild
> > CSG Software Developer
> > SwichTec Power Systems
> > New Zealand
> >
> > --------------------------------------------------------------
> > -------------
> >     New Zealand Delphi Users group - Delphi List -
> > [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to