title: Enum and polymorphism in Java, playing cards example
body: <p>I try to design a project about playing cards. I have a class Card</p>
  
  <pre><code>class Card 
  {
       Rank rank; 
       Suit suit;
  }
  </code></pre>
  
  <p>The Suit is an enum.</p>
  
  <pre><code>  enum Suit { .... }
  </code></pre>
  
  <p>Rank should have a method getValue().
  I would like to have more than one Ranks, ie. BlackJackRank and PokerRank. So I created an interface Rank with the method getValue and two enums BlackJackRank and PokerRank which implement this interface. </p>
  
  <pre><code>enum BlackJackRank implements Rank
  {
     ACE(1),DEUCE(2),THREE(3) ....
     private final int value;
     private BackJackRank(int value) { ... }
  
     @Override
     public int getValue() { ... }
  }
  </code></pre>
  
  <p>My problem is that I can't call the rank.name() and rank.ordinal() in the Card class because Rank is not enum. Any idea? </p>