Introduction to OOP | Chapter 9: A Solitare Game: | next | previous | audio | real | text |
public class PlayingCard { public PlayingCard (Suits sv, int rv) { s = sv; r = rv; faceUp = false; } public bool isFaceUp { get { return faceUp; } } public void flip () { faceUp = ! faceUp; } public int rank { get { return r; } } public Suits suit { get { return s; } } public Color color { get { if ( suit == Suits.Heart || suit == Suits.Diamond ) { return Color.Red; } return Color.Black; } } private bool faceUp; private int r; private Suits s; }