i am trying to build an interface array for my checker class. i have 3 classes:
main class, checker class and king class.
my interface:
interface IchecherMove{
bool isMoveValid(IchecherMove[,] checker, int columnStart, int rowStart, int columnEnd, int rowEnd);
string FindPiece();
string print();
bool pieceDevour(IchecherMove[,] checker, int columnStart, int rowStart, int columnEnd, int rowEnd);
}
i made an array out of it:
IchecherMove[ , ] checker = new Checker[9 , 9];
checker[8, 1] = new Checker("W");
checker[8, 3] =new Checker("W");
checker[8, 5] = new Checker("W");
checker[8, 7] = new Checker("W");
checker[7, 2] = new Checker("W");
checker[7, 4] = new Checker("W");
checker[7, 6] = new Checker("W");
checker[7, 8] = new Checker("W");
checker[6, 1] = new Checker("W");
checker[6, 3] = new Checker("W");
checker[6, 5] = new Checker("W");
checker[6, 7] = new Checker("W");
checker[1, 2] = new Checker("B");
checker[1, 4] = new Checker("B");
checker[1, 6] = new Checker("B");
checker[1, 8] = new Checker("B");
checker[2, 1] = new Checker("B");
checker[2, 3] = new Checker("B");
checker[2, 5] = new Checker("B");
checker[2, 7] = new Checker("B");
checker[3, 2] = new Checker("B");
checker[3, 4] = new Checker("B");
checker[3, 6] = new Checker("B");
checker[3, 8] = new Checker("B");
checker[5, 8] = new King("BK"); // this is shown as an error and it says " make sure the object type is convertiable to the array
The application of the the interface to the classes looks like that:
class Checker : IchecherMove
class King : IchecherMove
what does the program mean by the error aforementioned.? why can i put several objects into an interface array?