0

I have the following code:

class Foo
{
public:
  enum class MyEnum
  {
     option1,
     option2
  }
  "Some constructors"

private:
  "Some members and the following member"
  MyEnum enum_ = MyEnum::option1;
}

So basically, none of the constructors are setting the enum_ option, which is good. Because for all of them I want this value to be default set to option1. The problem is that after creating Foo object, option1 is not initialized for the enum_ value. None of option1/option2 is. The value is simply not initialized. I am wondering what I am doing wrong.

Ghasem Ramezani
  • 2,683
  • 1
  • 13
  • 32
A. Cimet
  • 87
  • 7

0 Answers0