I am working on the design problem, where I have to design a deck of cards. Here is how my classes look like
public interface ISuit {
String getLogo();
String getName();
}
public interface Icard<T extends ISuit> {
T getSuit();
String getNumber();
}
Now, I want to write a class for each of the 13 cards, something along the lines of this
public class Queen<E extends ISuit> implements Icard<E> {
@Override
public String getNumber() {
return "12";
}
@Override
public E getSuit() {
return new E;
}
}
I intend to create object of Queen like this
1: Queen<Hearts> queenOfhearts = new Queen<Hearts>();
However, for my queen class, I have a compile time error for getSuit. I don't know what is supposed to be the definition of getSuit. Is this function supposed to be made abstract?