Esempio n. 1
0
        static void Main()
        {
            EnemyTank     tx3Tank      = new EnemyTank();
            EnemyRobot    amyTheRobot  = new EnemyRobot();
            EnemyAttacker robotAdapter = new EnemyRobotAdapter(amyTheRobot);

            Write("The Robot:");
            amyTheRobot.ReactToHuman("Bishnu");
            amyTheRobot.WalkForward();
            amyTheRobot.SmashWitHands();

            Write("The Enemy Tank");
            tx3Tank.AssignDriver("Bishnu");
            tx3Tank.DriveForward();
            tx3Tank.FireWeapon();

            Write("The Robot with Adapter");
            robotAdapter.AssignDriver("Samir");
            robotAdapter.DriveForward();
            robotAdapter.FireWeapon();
        }
Esempio n. 2
0
 public EnemyRobotAdapter(EnemyRobot enemyRobot)
 {
     theRobot = enemyRobot;
 }