Exemple #1
0
        static void Main(string[] args)
        {
            Database     database   = new Database();
            FileWriter   fileWriter = new FileWriter();
            bool         isABadThingUsingAnimalsForSendingMessages = true;
            WorkingRobot workingRobot = new WorkingRobot();

            workingRobot.database   = database;
            workingRobot.fileWriter = fileWriter;

            if (isABadThingUsingAnimalsForSendingMessages)
            {
                workingRobot.notification = new MailNotification();
            }
            else
            {
                workingRobot.notification = new PidgeonNotification();
            }

            workingRobot.Work();
        }
        static void Main(string[] args)
        {
            Database     database   = new Database();
            FileWriter   fileWriter = new FileWriter();
            Notification notification;
            bool         isABadThingUsingAnimalsForSendingMessages = true;

            if (isABadThingUsingAnimalsForSendingMessages)
            {
                notification = new MailNotification();
            }
            else
            {
                notification = new PidgeonNotification();
            }


            WorkingRobot workingRobot = new WorkingRobot(database, fileWriter, notification);

            workingRobot.Work();
        }