课程: Complete Guide to C++ Programming Foundations
免费学习该课程!
今天就开通帐号,24,100 门业界名师课程任您挑!
Enumerations
- [Instructor] Now it's time to introduce the concept of enumerations. In C++, an enumeration or enum is a convenient way of defining a set of named integer constants. It is declared as a list of identifiers known as enumerators, which are assigned consecutive integer values starting from zero. That's why it's called an enumeration. Now, enumerations of this type were inherited from the C programming language, so they weren't really designed with object oriented programming in mind, and that makes them inappropriate for C++ code in most cases. One such problem is that C-style enumerators exist in the global scope, which may lead to naming conflicts or namespace pollution. Another problem is that C-style enums lack strong type checking, allowing implicit conversion between enums and integers, which is a safety hazard. A much better alternative that was introduced in the C++ 11 standard are enum classes. These are also known as scoped enums or strongly typed enums. Enum classes…
内容
-
-
-
-
Basic data types2 分钟 10 秒
-
(已锁定)
Integer types2 分钟 46 秒
-
(已锁定)
Floating point types1 分钟 29 秒
-
(已锁定)
Variables2 分钟 31 秒
-
(已锁定)
Using variables5 分钟 20 秒
-
(已锁定)
Type aliases3 分钟 58 秒
-
(已锁定)
Enumerations8 分钟 52 秒
-
(已锁定)
Structures3 分钟 13 秒
-
(已锁定)
Type casting6 分钟 18 秒
-
(已锁定)
Type casting examples7 分钟 2 秒
-
(已锁定)
Type inference with auto4 分钟
-
(已锁定)
Solution: Data types1 分钟
-
-
-
-
-
-
-
-
-