制作二十一点游戏并且需要知道如何使用基本成员初始化(即使用一元范围解析运算符在构造函数中初始化)来初始化数组。
//Constructor
Card::Card()
:mRank(static_cast<Rank>(ACE)), mSuit(static_cast<Suit>(SPADES)), mRankText(), mSuitText()
{
}
我想将参差不齐的数组 mRankText 和 mSuitText 初始化为
const char * rankText[NUMBER_OF_RANKS] = {"Ace",
"Deuce",
"Trey",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine",
"Ten",
"Jack",
"Queen",
"King"};
const char * suitText[NUMBER_OF_SUITS] = {"Spades",
"Clubs",
"Diamonds",
"Hearts"};