/* * Methods */ public void Ship(Customer customer, DeliveryService service) { if (!customer.IsLocal) { service.Deliver(this, customer); } }
static void Main(string[] args) { Product tinkerToys = new Product() { Title = "Tinker Toys", Description = "You can build anything you want", Price = 32.49, Quantity = 25 }; Customer marcus = new Customer() { FirstName = "Marcus", LastName = "Fulbright", IsLocal = false }; DeliveryService UPS = new DeliveryService() { Name = "UPS", TransitType = "train" }; // Ship the tinker toys to Marcus using UPS tinkerToys.Ship(marcus, UPS); }
static void Main(string[] args) { Customer customer = new Customer(); customer.ChangeFirstName("a"); Console.Write(customer.FullName); Product tinkerToys = new Product() { Title = "Tinker Toys", Description = "You can build anything you want" }; Customer marcus = new Customer() { FirstName = "Marcus", LastName = "Fulbright", IsLocal = false }; Customer jane = new Customer(); jane.FirstName = "Jane"; jane.LastName = "Doe"; jane.IsLocal = false; DeliveryService UPS = new DeliveryService() { Name = "UPS", TransitType = "train" }; Console.WriteLine(tinkerToys.Quantity); //UPS.TransitType = "carrier pigeon"; // Ship the tinker toys to Marcus using UPS tinkerToys.Ship(marcus, UPS); }