コード例 #1
0
ファイル: Program.cs プロジェクト: vasilvalchanov/OOP
        static void Main()
        {
            var repository = new CustomerRepository();

            var freePurchaseVisitor = new FreePurchaseVisitor();
            var discountRaseVisitor = new DiscountRaseVisitor();
            var premiumCustomers    = repository.GetPremiumCustomers();

            foreach (var premiumCustomer in premiumCustomers)
            {
                premiumCustomer.AcceptVisitor(discountRaseVisitor);
            }

            var allCustomers = repository.GetAll();

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

            foreach (var customer in allCustomers)
            {
                Console.WriteLine(customer);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: AsenTahchiyski/SoftUni
        static void Main()
        {
            var repository = new CustomerRepository();
            var visitorDiscount = new DiscountRaiseVisitor();
            var visitorFreeItem = new FreePurchaseVisitor();

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

            var allCustomers = repository.GetAll();
            foreach (var customer in allCustomers)
            {
                customer.Accept(visitorFreeItem);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }