//Program tested on Microsoft Visual Studio 2008 - Zahid Ghadialy
#include<iostream>
using namespace std;
int main()
{
enum Enum1
{
value1,
value2,
value3,
final_value = value3
};
//Print out the enum values
cout<<"Enum1 values : ";
for(int i = 0; i <= final_value; i++)
cout<<Enum1(i)<<" ";
cout<<endl;
enum extendedEnum1
{
value4 = final_value + 1,
value5,
value6,
new_final_value = value6
};
//Print out the enum values
cout<<"extendedEnum1 values : ";
for(int i = 0; i <= new_final_value; i++)
cout<<extendedEnum1(i)<<" ";
cout<<endl;
return 0;
}
The output is as follows: