A suit classifies a playing card into one of four categories: Hearts, Diamonds, Clubs, or Spades. A card combines a suit with a value from ace through king. section 5.1
Represent the suit with the C++11 scoped enumeration Suit. Write values as Suit::Hearts or Suit::Clubs, avoiding accidental comparisons with unrelated enumerations and requiring an explicit cast when treating a suit as a number. section 5.1.1
Putting a suit on a card
A Card can be aggregate-initialized with a numeric value and a suit: Card card{2, Suit::Clubs}. Stream output can initially show the underlying enum number, then improve to readable text such as “2 of Clubs” by converting the suit with to_string. section 5.1.1 section 5.1.4
Listing 5.4 Scope enum for suits
#pragma once #1
namespace cards #2
{
enum class Suit { #3
Hearts,
Diamonds,
Clubs,
Spades
};
}
Inspect the complete scoped enumeration and its four suit enumerators. section 5.1.1

