BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Few problems

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Mr B
Guest





PostPosted: Sun Feb 11, 2007 10:24 pm    Post subject: Few problems Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.