Here is some code that uses an enum:
enum color {red, green, blue};
color paint = green;
cout << paint << endl;
Rewrite this using strong enums. What is the advantage of strong enumerations over the
old style enumeration?
color paint = color::blue;
switch (paint)
{
case color::red:
cout << "red";
case color::green:
cout << "green";
case color::blue:
cout << "blue";
}
You may have discovered that you cannot print out an enum class with cout. This is
because enum classes are strongly typed and are not a simple mapping to integers. This
allows for stronger type checking which can help prevent storing invalid values in an eum
class variable.
You might also like to view...
Files whose contents must be handled as sequences of binary digits are called:
(a) text files (b) ASCII files (c) binary files (d) output files
What can you do if you suspect an application requires more privileges than the currently logged-on account?
A. run the application from the command line using the /highpriority parameter B. use the Run as administrator shortcut menu option C. double-click the application icon while holding down the Home key D. download a 64-bit version of the application and try it again
The three ways you can apply CSS styles to a document include all of the following except ____.
A. external styles B. inline styles C. internal style sheets D. external style sheets
Which of the following is the "super" account native to Linux and Macintosh OS X?
A. Administrator B. Root C. Admin D. Supervisor