If TShip needs TMissile and TMissile needs TShip, well then my program is trashed.
Of course, it might simply be a case of bad design :-)
But if you must reference like that, why not create a base type that they both extend...
eg:
flyingobjectthingy.bmx : Type TFlyingObjectThingy Field x, y Method IAmHit(byMissile:TFlyingObjectThingy) End Method End Type ship.bmx : import "flyingobjectthingy.bmx" import "missile.bmx" Type TShip extends TFlyingObjectThingy Field aMissile:TMissile Method IAmHit(byMissile:TFlyingObjectThingy) Local theMissile:TMissile = TMissile(byMissile) Print "Ouch" End Method Method fireAMissile() aMissile = new TMissile .... End Method End Type missile.bmx : import "flyingobjectthingy.bmx" Type TMissile extends TFlyingObjectThingy ... Method HitShip() Local theHitShip:TFlyingObjectThingy = someCollisionMethod() theHitShip.IAmHit( Self ) End Method End Type
The missile doesn't *have* to know what a ship is...
However, Max is a wee bit limited in that it only supports Extend and not Interfaces too, but it's workable...
At the end of the day, sue whatever way works for you...
:o)