Chapter 5. Study Guide

C++ is an extensible languages, which means that programmers are able to create new data types beyond the fundamental types introduced in chapter 1. So, extending the language by creating new, program-specific data types is the unifying theme of this chapter. C++'s primary mechanism for creating a new type is the "class" keyword (formally introduced in chapter 9). But it also allows programmers to create new types such as enumerations, structures, and bit-fields. The "typedef" keyword allows programmers to create new names for exiting complex types.

Enumerations are fairly simple. Although recent changes to the ANSI C++ standard have significantly increased the range of enumerations (making them more like Java's enumerations), we will restrict our studies to the older versions of enumeration, which are nothing more than a way of creating symbolic or named constants where the values are all of type int.

Structures provide a syntax for creating structured or aggregate data types. They allow programmers to create variables that contain other variables called fields or members. From your experience in CS 1400, you may notice that structures are similar to classes. Although structures and classes are similar, C++ programmers typically don't use the public or private keywords with structures, nor do they typically put functions or methods in them. (Technically, the only difference between structures and classes in C++ is the default visibility: by default, everything in a structure is public and everything in a class is private.)

Know