Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

namespace

Status
Not open for further replies.

mayu03

Programmer
Joined
Oct 3, 2003
Messages
91
Location
US
I have the following code
enum {green,red,black} ;
How do I replace this with namespace? Could it be done?
 
stupid situation. You can do it, but it does not make sence to change enum to namespace:
enum colors{green,red,black} ;
color x = green;
int y = (int)black;
change to
namespace colors
{
const int green = 1
const int red = 2;
const int black = -1;
}
int x = colors::green;
using namespace colors;
int y = black;

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top