static void Main(string[] args)
        {
            /* sekciq 1 */
            Tank tank = new Tank();

            tank.DriveForward();
            tank.FireWeapen();
            tank.AssignDriver("John");

            System.Console.WriteLine(new String('-', 10));
            /* sekciq 2 */
            Robot robot = new Robot();

            robot.WalkForward();
            robot.SmashWithHands();
            robot.ReactToHuman("Jack");

            System.Console.WriteLine(new String('-', 10));


            /*
             * Ako klientskiq kod ochakva samo edni i sashti metodi
             * nqma kak vtorata chasht ot koda da bade izvikana
             * po kakavto i da e nachin. (sekciq 2)
             */
            RobotAdapter robotAdapter = new RobotAdapter(robot);

            robotAdapter.DriveForward();
            robotAdapter.FireWeapen();
            robotAdapter.AssignDriver("Jack");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Human Kalle = new Human();
            Robot Lasse = new Robot();
            IHumanBehaviour robotAdapter = new RobotAdapter(Lasse);

            Console.WriteLine("The human:");

            Kalle.sleep();
            Kalle.talk();
            Kalle.walk();
            Console.WriteLine();

            Console.WriteLine("The robot:");
            Lasse.recharge();
            Lasse.communicate();
            Lasse.rolls();
            Console.WriteLine();

            Console.WriteLine("The humaniod:");
            robotAdapter.sleep();
            robotAdapter.talk();
            robotAdapter.walk();
            Console.WriteLine();
            Console.ReadLine();
        }