我会在你的卡类的定义中这样做:
class Card
{
public:
typedef enum
{
Two = 0,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
Ace
} Face;
};
Run Code Online (Sandbox Code Playgroud)
或 C++11:
class Card
{
public:
enum Face: unsigned char
{
Two = 0,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
Ace
};
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7293 次 |
| 最近记录: |