Easy learning with example program codes

CPP Enumeration

Enum is a data type defined in CPP library that can include fixed set of static and implicit constants like days of the week, directions etc.

Advantages of using Enum:

  • Improves type safety.
  • Can be easily used in switch.
  • Can be traversed.
  • Can have fields, constructors and methods.
  • May implement many interfaces but cannot extend any class because it internally extends Enum class.


#include <iostream.h>  
using namespace std;  
enum directions { North, South, East, West };  
int main()  
directions direction;  
direction = East;  
cout << "Direction: " << direction+1 <<endl;  
return 0;  


Direction: 3
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki