public static void Main()
        {
            var repository = new CustomerRepository();
            var discountVisitor = new DiscountRaiseVisitor();
            var freePurchaseVisitor = new FreePurchaseVisitor();

            var premiumCustomers = repository.GetPremiumCustomers();
            foreach (var premiumCustomer in premiumCustomers)
            {
                premiumCustomer.Accept(discountVisitor);
            }

            var allCustomers = repository.GetAll();
            foreach (var customer in allCustomers)
            {
                customer.Accept(freePurchaseVisitor);
            }
        }
Example #2
0
        static void Main()
        {
            var repository = new CustomerRepository();

            var premiumCustomers = repository.GetPremiumCustomers();
            var discountVisitor  = new DiscountRaiseVisitor();

            foreach (var premiumCustomer in premiumCustomers)
            {
                premiumCustomer.Accept(discountVisitor);
            }

            var allCustomers        = repository.GetAll();
            var freePurchaseVisitor = new FreePurchaseVisitor();

            foreach (var customer in allCustomers)
            {
                customer.Accept(freePurchaseVisitor);
            }
        }