I've set up a GenericPeice class that all sub classes inherit from. Each sub class has a it's own draw method. When I declared the peices in an array, I used GenericPiece for the array type, and I need to call the draw function, but since GenericPiece doesn't have the draw method, i get an error when I do something like:
for(int i=0; i<32; i++) {
// Draw all the pieces, unless of course they don't exist yet.
if(pieces[i] == null)
continue;
pieces[i].draw(this, g);
}
How do I get around this?
(Incidentally, how are you putting an object in an array? I thought they could only store primitives...)