enum field
#include <iostream>
using namespace std;
enum Days { Monday, Tuesday, Wednesday, Thursday, Friday };
class MyClass
{
public:
int *lucky_number;
enum Days lucky_day;
};
int main(void)
{
MyClass wow;
int lucky = 1500;
wow.lucky_day = Monday;
wow.lucky_number = &lucky;
cout << *(wow.lucky_number) << endl;
switch (wow.lucky_day)
{
case Monday: cout << "Monday\n";
break;
default: cout << "My lucky day ain't any day but Monday\n";
};
}
Related examples in the same category