delphi - Circular reference fix? -


i have player class in separate unit follows:

tplayer = class private   ...   fworld: tworld;   ... public   ... end; 

i have world class in separate unit follows:

tworld = class private   ...   fplayer: tplayer;   ... public   ... end; 

i have done way player can data world via fworld, , other objects in world can player data in similar manner.

as can see results in circular reference (and therefore not work). have read implies bad code design, can't think of better other way. better way it?

cheers!

every once in while called for, , this:

//forward declaration: tworld = class;  tplayer = class private    fworld: tworld; public end;  tworld = class private   fplayer: tplayer; public end; 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -