Пример #1
0
        public static void Main()
        {
            RobotBuilder  oldStyleRobot = new OldRobotBuilder();
            RobotEngineer robotEngineer = new RobotEngineer(oldStyleRobot);

            robotEngineer.makeRobot();
            Robot robot = robotEngineer.getRobot();

            Console.WriteLine(robot);
        }
Пример #2
0
        private static void RobotBuilder()
        {
            IRobotBuilder oldStyleRobot = new OldRobotBuilder();
            RobotEngineer robotEngineer = new RobotEngineer(oldStyleRobot);

            robotEngineer.MakeRobot();

            Robot firstRobot = robotEngineer.GetRobot();

            IRobotBuilder alloyRobot = new ModernRobotBuilder();

            robotEngineer = new RobotEngineer(alloyRobot);
            robotEngineer.MakeRobot();

            Robot modernRobot = robotEngineer.GetRobot();

            Console.Read();
        }