当前位置: 首页 > 工具软件 > deck > 使用案例 >

D2: deck of cards

邢良才
2023-12-01
imagine we’re designing the objects for a deck of cards. Consider the following approach:
1.  What are you trying to do with the deck of cards? Ask your interviewer.  Let’s assume 
we want a general purpose deck of cards to implement many di#erent types of card 
games.
2.  What are the core objects—and what “sub types” are there? For example, the core 
items might be: Card, Deck, Number, Suit, PointValue
3.  Have you missed anything? Think about how you’ll use that deck of cards to imple-
ment di#erent types of games, changing the class design as necessary. 
4.  Now, get a little deeper: how will the methods work? If you have a method like Card 
Deck:.getCard(Suit s, Number n), think about how it will retrieve the card. 
 类似资料:

相关阅读

相关文章

相关问答