Here is an example of an abstract Deck class, with specific implementations of PokerDeck and MagicDeck. As others have said, I'm not sure if this is the best example, because there really isn’t much in common between games.
Perhaps if you did something like Hand with SpadesHand, HeartsHand, PinochleHand, PresidentsHand, where you will have several # cards in each hand. Each game has a "PlayNextCard" method, and they have different rules, but everyone revolves around putting a card from your hand on a common pile.
public abstract class Deck
{
public int NumberOfCards{get; private set;}
public IEnumerable<Card> Cards {get; private set;}
public void Shuffle()
{
Cards = RandomizeCards();
}
protected abstract IEnumerable<Card> CreateCardList();
}
public class PokerDeck
{
public PokerDeck()
{
NumberOfCards = 52;
Cards = CreateCardList();
}
}
public class MagicDeck
{
public MagicDeck()
{
NumberOfCards = 10000;
Cards = CreateCardList();
}
}
Then you implement CreateCardList for each specific class. Thus, poker has 2-A for Hearts, Spades, Clubs and Diamonds. Magic has what a magic deck has.
You do not need to implement the Shuffle method because it runs in the base class.