 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mr B Guest
|
Posted: Sun Feb 11, 2007 10:24 pm Post subject: Few problems |
|
|
Hi all,
Just wondering if somebody could point me in the right direction.
I'm
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
about
the structure, my program consists of
TWorld.cpp
Creature.cpp
Creature.h
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
from,
inside the TCreature.cpp.
For the creature.h file I have the
#ifndef CreatureH
#define CreatureH
#endif
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
a
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
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.
Daniel |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|