static void Main(string[] args) { var b = new Banana(); var m = new Mango(); var s = new Strawberry(); var c = new IceCubes(); Console.WriteLine(b.Blend()); Console.WriteLine(m.Blend()); Console.WriteLine(s.Blend()); List <IBlendable> fruityList = new List <IBlendable>() { b, m, s, c }; foreach (dynamic fruit in fruityList) { Console.WriteLine(fruit.Blend()); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var b = new Banana(); var m = new Mango(); var s = new Strawberry(); var c = new IceCubes(); Console.WriteLine(b.Blend()); Console.WriteLine(m.Blend()); Console.WriteLine(s.Blend()); List <IBlendable> fruits = new List <IBlendable> { b, m, s, c }; foreach (IBlendable fruit in fruits) { Console.WriteLine(fruit.Blend()); } }
static void Main(string[] args) { List <iBlendable> blendables = new List <iBlendable>(); blendables.Add(new Strawberry()); blendables.Add(new Banana()); blendables.Add(new CellPhone()); blendables.Add(new IceCubes()); blendables.Add(new Mango()); Banana b = new Banana(); blendables.Add(b); string mess = ""; foreach (iBlendable o in blendables) { mess += o.Blend() + " "; } Console.WriteLine(mess); }
static void Main(string[] args) { //Console.WriteLine("Hello World!"); var b = new Banana(); var m = new Mango(); var s = new Strawberry(); var c = new IceCubes(); Console.WriteLine(b.Blend()); Console.WriteLine(m.Blend()); Console.WriteLine(s.Blend()); List <IBlendable> list = new List <IBlendable>() { b, m, s, c }; foreach (dynamic blend in list) { Console.WriteLine(blend.Blend()); } }
static void Main(string[] args) { List <IBlendable> blendables = new List <IBlendable>(); blendables.Add(new Strawberry()); blendables.Add(new Banana()); blendables.Add(new CellPhone()); blendables.Add(new IceCubes()); for (int i = 0; i < 10; i++) { blendables.Add(new Mango()); } Banana b = new Banana(); blendables.Add(b); string mess = ""; foreach (IBlendable blendable in blendables) { mess += blendable.Blend(); } Console.WriteLine(mess); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var b = new Banana(); var m = new Mango(); var s = new Strawberry(); var c = new IceCubes(); Console.Write(b.Blend() + "\n\n"); Console.Write(m.Blend() + "\n\n"); Console.Write(s.Blend() + "\n\n"); List <Iblendable> snax = new List <Iblendable>() { b, m, s, c }; foreach (Iblendable f in snax) { Console.Write(f.Blend() + "\n\n"); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var b = new Banana(); var s = new Strawberry(); var m = new Mango(); var c = new IceCubes(); var p = new CellPhone(); Console.WriteLine(b.Blend()); Console.WriteLine(s.Blend()); Console.WriteLine(m.Blend()); List <IBlendable> fruits = new List <IBlendable>() { b, s, m, c, p }; foreach (var fruit in fruits) { Console.WriteLine(fruit.GetType()); Console.WriteLine(fruit.Blend()); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var b = new Banana(); var m = new Mango(); var s = new Strawberry(); var ice = new IceCubes(); var cell = new CellPhone(); //Console.WriteLine(b.Blend()); //Console.WriteLine(m.Blend()); //Console.WriteLine(s.Blend()); List <IBlendable> fruits = new List <IBlendable>() { b, m, s, ice, cell }; foreach (dynamic f in fruits) { Console.WriteLine(f.Blend()); } }