Let me give an example then. Here are some relationships:
A flight is assigned an aircraft.
An aircraft is of a certain config (seating, etc.)
An aircraft is of a certain type (which gives us size, body style)
To calculate the estimated passenger loading time for the flight, we need to know the number of seats (from "config") and the body style (e.g. narrow, wide, commuter from "type").
My classes are as follows.
Flight //has a pointer to aircraft
FlightCollection //std::list of flights
Aircraft //
needs a config and a type - index or pointer? AircraftCollection //std::list of aircraft
Config //also point to type - has functions for returning boarding times
ConfigCollection //either array or list?
Type
TypeCollection //either array or list?
With this structure, I would have to have the Flight class calling functions from Config and Type. The way I had done it was through the container ("collection") classes. Of course, that would necessitate that I pass those classes in by reference. That''s fine if you are passing one or two around, but it was getting to the point where I was having to pass 3-6 of them around by reference. Not tidy at all. That''s when I was looking for a better way.
With an experiment today, I have found out that I can do it by declaring those container classes as Singletons (thanks fup) so I can call their functions at will.
Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"