Hi, I have met a problem to use BetterEnums in class.
This is sample code.
BETTER_ENUM(EnumTest, uint32, NONE = 0, APPLE)
class Apple
{
public:
Apple() : test(EnumTest::APPLE) {}
Apple(int k) {}
EnumTest test;
};
consoleapplication1.cpp(32): error C2248: 'EnumTest::EnumTest': cannot access private member declared in class 'EnumTest'
consoleapplication1.cpp(26): note: see declaration of 'EnumTest::EnumTest'
consoleapplication1.cpp(26): note: see declaration of 'EnumTest'
I could solve this problem by this code.
BETTER_ENUM(EnumTest, uint32, NONE = 0, APPLE)
class Apple
{
public:
Apple() : test(EnumTest::APPLE) {}
Apple(int k) : test(EnumTest::APPLE) {}
EnumTest test;
};
or
class Apple
{
public:
Apple() {}
Apple(int k) {}
EnumTest test = EnumTest::APPLE;
};
Hi, I have met a problem to use BetterEnums in class. This is sample code.
BETTER_ENUM(EnumTest, uint32, NONE = 0, APPLE)
class Apple { public: Apple() : test(EnumTest::APPLE) {} Apple(int k) {} EnumTest test; };
consoleapplication1.cpp(32): error C2248: 'EnumTest::EnumTest': cannot access private member declared in class 'EnumTest' consoleapplication1.cpp(26): note: see declaration of 'EnumTest::EnumTest' consoleapplication1.cpp(26): note: see declaration of 'EnumTest'
I could solve this problem by this code.
BETTER_ENUM(EnumTest, uint32, NONE = 0, APPLE)
class Apple { public: Apple() : test(EnumTest::APPLE) {} Apple(int k) : test(EnumTest::APPLE) {} EnumTest test; };
or
class Apple { public: Apple() {} Apple(int k) {} EnumTest test = EnumTest::APPLE; };
Thanks.