static void Main(string[] args) { Baverage baverage = new DarkRoast("Какое-то кофе!"); baverage = new Milk(baverage, "Молоко!"); baverage = new Milk(baverage, "Молоко!"); baverage = new Soy(baverage, "Soy!"); Console.WriteLine(baverage.getDescription() + "=" + baverage.cost() + "$"); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Beverage espresso = new Espresso(); Console.WriteLine(espresso.Description + " costs: " + espresso.cost()); Beverage beverage = new DarkRoast(); Console.WriteLine(beverage.Description + " costs: " + beverage.cost()); beverage = new Mocha(beverage); Console.WriteLine(beverage.Description + " costs: " + beverage.cost()); beverage = new Soy(beverage); Console.WriteLine(beverage.Description + " costs: " + beverage.cost()); beverage = new Whip(beverage); Console.WriteLine(beverage.Description + " costs: " + beverage.cost()); Console.ReadLine(); }
static void Main(string[] args) { System.Console.WriteLine("woof!"); Beverage my_bev = new Espresso(Beverage.bev_size.VENTI); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); my_bev = new Mocha(my_bev); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); my_bev = new Mocha(my_bev); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); my_bev = new Soy(my_bev); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); my_bev = new Whip(my_bev); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); my_bev = new Whip(my_bev); System.Console.WriteLine("my_bev[" + my_bev.getDescription() + "]"); System.Console.WriteLine("my_bev.cost[" + my_bev.cost() + "]"); }