/ Bladewarrior, Im , 2 .
, :
Fight(PlayerOne[i], PlayerOne[j]);
, . , , , . # 4, dynamic :
static class FightArena {
public static void Fight(dynamic a, dynamic b) {
try {
DoFight(a, b);
} catch {
Console.Error.WriteLine("{0} and {1} cannot fight", a, b);
}
}
private static void DoFight(BladeWarrior a, Archer b) {
}
private static void DoFight(BladeWarrior a, FistWarrior b) {
}
private static void DoFight(BladeWarrior a, RedMage b) {
}
private static void DoFight(BladeWarrior a, BlueMage b) {
}
private static void DoFight(BladeWarrior a, BladeWarrior b) {
}
private static void DoFight(Archer a, Archer b) {
}
...
}
:
FightArena.Fight(PlayerOne[i], PlayerOne[j]);
PlayerOne[i] PlayerOne[j].