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); } }
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); } }