Cross reference classes: Best practice

Attempting to make a class hierarcy With TMS Aurelius. I have 2 classes, TPerson and TCompany. I want TPerson to contain a Reference to TCompany (Person.Company). I also want the Company to contain a list of all employees (Company.Employees). I am not sure how to accomplish this, as Delphi reads its declared classes in order. So if i declare TPerson first, i cannot add a property that holds the Company, as delphi does not recognize TCompany before it is declared. This is how I would do this in NHibernate (vb .net):



Public Class TPerson

   Public Property ID

   Public Property Company As TCompany

End Class



Public Class TCompany

   Public Property ID

   Public Property Empoyees As List(Of TCompany)

End Class



And that would work fine. But in Delphi:



Type

   TPerson = Class

   private

      FId: Integer;

      FCompany: TCompany;

   Public

      Properties.....

end;



Type

   TCompany= Class

   private

      FId: Integer;

      Employees: TList<TPerson> ;

   Public

      Properties.....

end;



it does not recognize TCompany because it is not declared yet. Is there a best practice to accomplish this? Can only find one-way declarations in the manual, and i need to Access these both ways.

Pre declare your classes

Interface
Uses
  ......

Type

   TPerson = Class;
   TCompany= Class;



   TPerson = Class

   private

      FId: Integer;

      FCompany: TCompany;

   Public

      Properties.....

end;



   TCompany= Class

   private

      FId: Integer;

      Employees: TList<TPerson> ;

   Public

      Properties.....

end;

Nice, thank you!