c#中编的牌类游戏中的问题

public Card(Suit suit, FaceValue faceVal, bool isCardUp)
        {
            this.suit = suit;
            this.faceVal = faceVal;
            this.isCardUp = isCardUp;
        }

        /// <summary>
        /// Return the card as a string (i.e. "The Ace of Spades")
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return "The" + faceVal.ToString() + "of" + suit.ToString();
        }

最后那句什么意思啊?没见过这种用法啊?


萧十郎
浏览 375回答 2
2回答

温温酱

重载ToString()函数。就是当你调Card.ToString()的时候输出自定义的字符串
打开App,查看更多内容
随时随地看视频慕课网APP