Few problems

2007-02-12 12:24:26 AM
Hi all,
Just wondering if somebody could point me in the right direction.
trying to create a multifile project in Borland C++ builder for the
first time and i'm getting error messages saying that the body to a
function has been defined earlier. let me explain a little more
the structure, my program consists of
what I want to do is seperate the classes for TCreature from the code
which I want in the header file. This is where the errors stems
inside the TCreature.cpp.
For the creature.h file I have the
#ifndef CreatureH
#define CreatureH
to prevent the file from being included twice.
At the moment I have it all inside the header file and this works
fine. The other issue I have is trying to associate the instance of
class with the instantiation of another.
I want all objects of type Creature to have access to a look-up table
class called CreatureVision. This has a single instance of the
struct Position
int mx;
int my;
}; and two, 2-D arrays, as well as two member functions so I need it
to be a class. But I only want it created once, so all Creature
objects can access its data. Could I use the static keyword and how
would this work as the two arrays are initialised in the constructor.
Also I read that static cannot be used in header files.
Thanks very much for your time and any suggestions.