
Patrick B. answered 10/16/19
Math and computer tutor/teacher
//Declares and defines the enum in the private section of the class
using namespace std;
#include <iostream>
class test
{
private:
typedef enum _TEnumFunctionality
{
FUNCTIONALITY_NORMAL, FUNCTIONALITY_RESTRICTED, FUNCTIONALITY_FOR_PROJECT_X
} TEnumFunctionality;
TEnumFunctionality projectX;
public:
test ( int x)
{
// sets the enum based on the value of x
switch (x)
{
case 0: { projectX = FUNCTIONALITY_NORMAL;
break;
}
case 1: {
projectX = FUNCTIONALITY_RESTRICTED;
break;
}
case 2:
{
projectX = FUNCTIONALITY_FOR_PROJECT_X;
}
} //switch
} //constructor
GetProjX() { return(projectX); }
};
int main()
{
test T(1);
test t(0);
test X(2);
cout << T.GetProjX( ) << endl;
cout << t.GetProjX( ) << endl;
cout << X.GetProjX( ) << endl;
}