예제 #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();
        }
예제 #2
0
 public void AssignDriver(string driver)
 {
     theRobot.ReactToHuman(driver);
 }