Link to home
Start Free TrialLog in
Avatar of ricbrad
ricbrad

asked on

How can you declare mutually dependent object datatypes?

I want to have two object types that refer to each other in their definitions, but I can't get it to compile.

For example, how can I make the following work:

---

type Tfoo = class
      procedure munge(bar : tBar);
   end;

type Tbar = class
      procedure munge(foo : tFoo);
   end;

---

Many thanks,


Rich
ASKER CERTIFIED SOLUTION
Avatar of Lee_Nover
Lee_Nover

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Lee_Nover, your example will work just for class members...
  TBar = class;

  TFoo = class
    member : TBar;
  end;

  TBar = class
    member : TFoo;
  end;
sorry, my mistake... I made something wrong... :)
Avatar of Wim ten Brink
LOL@Ivanov_G
That's what we call a moment of total blindness... :-P Don't worry, none of us are perfect, not even me...