I have the error:
Type mismatch: cannot convert from element type Object to Card
with the following code:
Deck Removal
....
for (Card c : Removal)
d.removeCard(c);
This is the iterator method in my deck class:
@Override
public Iterator<Card> iterator()
{
return deck.iterator();
}
The underlying structure for the deck is Vector<Card>. My iterator is returning type Card. Why is it telling me it's Object in the for loop?
I can do the following and then the error would go away but that's quite stupid since I'm already supposed to return Cards instead of Objects.
Deck Removal
....
for (Object c : Removal)
d.removeCard((Card)c);
Thanks
IterableorIterable<Card>?Vectoris only used in out-of-date educational materials. In the real world, it is a long-abandoned, deprecated and broken class.