Member Avatar for j.kelly

Can somebody please tell me where I should put an enumeration which will be used by several classes.

enum Direction
{
             UP = 1,
	DOWN = 2,
	NONE = 3
};

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 >>

Recommended Answers

All 2 Replies

Why not put that in its own header and #include it where you need it?

Member Avatar for j.kelly

Ok, will do.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.