(bright music)
(keys clack)
Frank: Welcome to this bonus section for the course.
In this section, we'll learn
about the basics of C++ enumerations
also known as enumerated data types or enums.
Please note that there are some concepts, constructs,
and techniques that I will use in this section
of the course that you may not have learned yet,
depending on how much of the course you've completed.
For example, I'll use the if, else statements,
switch statements, the range based for loop, vectors,
functions, and overloaded operators.
All of these are covered in the course.
If you haven't already completed those sections
of the course,
I strongly urge you to complete those sections
before you do this one.
For your reference,
vectors are covered in sections seven and 20.
Functions are covered in section 11.
Strings are covered in section 10.
Control structures such as the if, else switch
and range based for loop are covered in section nine
and operator overloading is covered in section 14.
Enumerated types were first introduced
in 1970 in the Pascal programming language.
Since their creation, almost every other language
has adopted enumerated data types of some form.
Later, the C programming language
introduced the enum keyword
so in C++, enumerated types were inherited
from C and extended in C++ 11 and forward.
So what's an enumerated type?
Well, in short,
an enumerated type provides a useful way to store a set
of named integral constants known as enumerators.
In order to fully understand the enumerations,
we need to take a closer look.
First, we'll see what motivated the creation
of enumerated data types and see how they became so popular.
Next, we'll look at the syntax of a C++ enumeration
and go through every part of it.
We'll then see the difference
between unscoped and scoped enumerations.
Unscoped enumerations require no name qualification
so they're visible throughout the scope
in which the enumeration is defined.
Scope enumerators do require a name qualification
and so they can be accessed
only using the scope resolution operator.
Finally, we'll head over to the IDE
and see some of the most common uses of enumerations.
Before we get started, remember,
I'm only covering the basics of C++ enumerations.
Now let's head over
to the next video to see what motivated the creation
of enumerated data types
and how they're used in C++.