C++ Enumeration
w3hello.com logo
C++ Basics
What is C++
Introduction to C++
C++ Installation
Comments in C++
C++ Variables
C++ Pointer Operators
C++ Data Types
C++ Variable
C++ Loop Types
Discuss C++
C++ While Loop
C++ do while loops
C++ while loops
C++ Increment and Decrement Operators
C++ For Loop
C++ if Statements
C++ nested if statements
C++ Comments
C++ for loops
C++ do...while loop
C++ if-else Statements
C++ switch
C++ if...else statement
C++ OOPs Concepts
Operators in C++
C++ Operators
C++ Loops
C++ Member (dot & arrow) Operators
C++ Basic Input Output (cin, cout, endl)
Operators Precedence in C++
C vs C++
C++ switch Statements
C++ if-else
C++ Exception Handling
Constructors and Destructors in C++
C++ File and Stream
C++ Continue Statement
C++ Object Oriented
C++ Arithmetic Operators
C++ Pointers
Pointers in C++
C++ try-catch
C++ Enumeration
ANSI C++ New Features
C++ Recursion
C++ Modifier Types
C++ Break Statement
C++ ios_base init
C++ Compute the Sum and Average of Two Numbers
C++ Preprocessor
C++ Class Constructor and Destructor
Matrix Multiplication in C++
C++ Strings
C++ Basic Input/Output
C++ Qualifiers and Storage Classes
C++ Assignment Operators
Data Abstraction in C++
C++ Class Access Modifiers
C++ Structs
Interfaces in C++ (Abstract Classes)
String Manipulation in C++
C++ References
C++ Date and Time
C++ Useful Resources
C++ ios_base openmode
C++ Aggregation
C++ Introduction
Call by value and call by reference in C++
C++ ios_base fmtflags
C++ Templates
C++ Namespaces
C++ Fstream fpos
C++ ios_base event
Returning values by reference in C++
C++ Polymorphism
C++ nested loops
C++ Constants
C++ Casting Operators
C++ Objects and Classes
C++ static
Storage Classes in C++
C++ ios_base seekdir
Data Encapsulation in C++
C++ Null Pointers
C++ Inheritance
Armstrong Number in C++
C++ switch statement
C++ Encapsulation
Pointer to C++ Classes
C++ Files and Streams
C++ Interfaces
Data Types in C++
Variable Scope in C++
C++ Destructor
C++ Manipulators
Static Members of a C++ Class
Fibonacci Series in C++
C++ this Pointer
C++ Object Class
Polymorphism in C++
C++ Basics
Previous : C++ try-catch Next : ANSI C++ New Features

C++ Enumeration

Enum in C++ is a data type that contains fixed set of constants.

It can be used for days of the week (SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY and SATURDAY) , directions (NORTH, SOUTH, EAST and WEST) etc. The C++ enum constants are static and final implicitly.

C++ Enums can be thought of as classes that have fixed set of constants.

Points to remember for C++ Enum

  • enum improves type safety
  • enum can be easily used in switch
  • enum can be traversed
  • enum can have fields, constructors and methods
  • enum may implement many interfaces but cannot extend any class because it internally extends Enum class

C++ Enumeration Example

Let's see the simple example of enum data type used in C++ program.


Day: 5
Previous : C++ try-catch Next : ANSI C++ New Features
© Copyright 2018 W3Hello Publishing Limited. All rights reserved.
Contact us | Sitemap