C++ Beginner - Enumerations

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 10
Reputation: j.kelly is an unknown quantity at this point 
Solved Threads: 0
j.kelly j.kelly is offline Offline
Newbie Poster

C++ Beginner - Enumerations

 
0
  #1
Mar 19th, 2005
Can somebody please tell me where I should put an enumeration which will be used by several classes.

  1. enum Direction
  2. {
  3. UP = 1,
  4. DOWN = 2,
  5. NONE = 3
  6. };

All of the classes have their own .h and .cpp files and at the moment I have the enumeration repeated in all the header files for the classes which use it.

I assume repeating the enum in multiple files is the wrong way to do it. Is there a right way to do it?

Thanks,
James


<< moderator edit: added code tags: [code][/code] tags >>
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 254
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: C++ Beginner - Enumerations

 
0
  #2
Mar 19th, 2005
Why not put that in its own header and #include it where you need it?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 10
Reputation: j.kelly is an unknown quantity at this point 
Solved Threads: 0
j.kelly j.kelly is offline Offline
Newbie Poster

Re: C++ Beginner - Enumerations

 
0
  #3
Mar 19th, 2005
Ok, will do.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1396 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC