I need to have one instance of a class called TGrid shared amongst my main
BCB class and also many instances of classes called TAgent and TFood. The
way I understand it I should be using extern to accomplish this.
In my TGrid header I declare the instantiation as:
In the main, TAgent and TFood class headers I have:
extern TGrid theGrid;
I also make sure each of these has 'TGrid.h' included.
This compiles OK but for some reason the main class does not seem to share
the data in theGrid with the other classes. This class represent a
2-dimensional grid (x,y) of TList objects representing items on a grid. If I
add items via TAgent they don't show up if I later read them in the main
I have also tried using a static instance of TGrid instead of extern, and
that had similar results.
Please can somebody advise me on what I'm doing wrong?
-=I haven't lost my mind; it's backed up on tape.=-