Interdependent modules?

BCS BCS at pathlink.com
Tue Jun 20 09:07:30 PDT 2006


Jeremy Gibson <jtgibson telus net> wrote:
> I have a pair of modules which need one another's functionality, and I've been
> poring through the documentation on trying to figure out how to get them working
> together, to no avail.  The structure is basically as follows (with unnecessary
> baggage trimmed out):
> 
> gameobject.d
> ============
> import data (for ac_data class)
> class ac_object : ac_data
> 
> data.d:
> =======
> import gameobject (for ac_object class)
> class ac_data
> class ac_location : ac_data
> class ac_region : ac_location
> function ac_region.Contains(ac_location location)
> function ac_region.Contains(ac_object object)
> 

option #3

  gameobject.d
  ============
  import data (for ac_data class)
  class ac_object : ac_data

  data.d:
  =======
// import gameobject (for ac_object class)
  class ac_data
  class ac_location : ac_data
// class ac_region : ac_location
// function ac_region.Contains(ac_location location)
// function ac_region.Contains(ac_object object)


  geometry.d:
  =======
  import data (for ac_location class)
  import gameobject (for ac_object class)

  class ac_region : ac_location
{
  function ac_region.Contains(ac_location location)
  function ac_region.Contains(ac_object object)
}

Might work.



More information about the Digitalmars-d-learn mailing list