enumerations class

Hello,
How I can declare the enumeration class as an interface and a realization in this situation:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 namespace Menu
{
	//errors
	class WrongInPut {};


	enum class Identifier;
	

	Identifier FeedBack();
	void GUI();
}

/* here should be the realization which incomprehensible for me */
thanks in advance
Can you be more precise? An enum class is a scoped and safer form of enum, it is not actually a fully fledged class. If by interface, you mean a java-like interface, you need to use an abstract class, not an enum class.

You can declare an enum class just like an ordinary enum
1
2
3
4
5
6
7
enum class color : uint8_t
{
    red, green, blue
};

color backgroundColor = color::blue;
either re-open the namespace

1
2
3
4
namespace Menu {
  enum class Identifier { A, B, C};
  Identifier FeedBack() { return Identifier::A; }
}


demo https://wandbox.org/permlink/YYbA07cnL3Ta4ysO

or use full qualifications:
1
2
enum class Menu::Identifier { A, B, C};
Menu::Identifier Menu::FeedBack() { return Identifier::A; }

demo https://wandbox.org/permlink/KIugM5DAIKXRuaep

Best, however, is to define the enum completely the first time.
The MicVisStudio out to me: there is an error,
but now I looked at my code and the error gets lost.
mm ok, but anyway thx for your answers!
Topic archived. No new replies allowed.