The following code works in VC++ 2010 but generates numerous errors in VC++ 2012:

#include "stdafx.h"

using namespace System;

enum class Months{January = 1, February, March, April };

int main(array<System::String ^> ^args)
{
Months month;
int value;

month = Months::January;
value = safe_cast<int>(month);
Console::WriteLine(L"Month is {0} and the value is {1}.", month, value);



return 0;
}

In order to compile in VC++ 2012, the code must be changed to:

private enum class Months{January = 1, February, March, April };

My question is why?
Is VC++ so chaotic that code from one version won't compile in another version? Doesn't that defy the idea of portable code?

When does one use enum and when does one use private enum?