public void CallingInterfaceMethods() { //new up an instance of an IFruite IFruit banana = new Orange(); string output = banana.Peel(); Console.WriteLine(output); Console.WriteLine($"The {banana.Name} is peeled:" + banana.Peeled); }
public void CallingInterfaceMethods() { //New up an instance of an IFruit IFruit fruit = new Orange(); string output = fruit.Peel(); Console.WriteLine(output); Console.WriteLine($"The {fruit.Name} is peeled: " + fruit.Peeled); }
public void CallingInterfaceMethods() { //New up an instance of an IFruit IFruit fruit = new Orange(); // control r r will automatically rename all instances (fruit) string output = fruit.Peel(); Console.WriteLine(output); Console.WriteLine($"The {fruit.Name} is peeled: " + fruit.Peeled); }
public void CallingInterfaceMethods() { // New up an instance of an Ifruit IFruit fruit = new Orange(); //calling just Ifruit props , not banana or orange // we can change new Banana to Orange or grape and get new output for everything string output = fruit.Peel(); Console.WriteLine(output); Console.WriteLine($"The {fruit.Name} is peeled: " + fruit.Peeled); var fruits = new Orange(); // but from here I can call orange sqeeze method, because "var" not Ifruit. fruits.Squeeze(); }
public void OrangeTest() { Orange orange = new Orange(true); Orange unOrange = new Orange(false); Console.WriteLine(orange.Peel()); Console.WriteLine(unOrange.Peel()); string SmallerNum(string n1, string n2) { int result = String.Compare(n1, n2); return(result <= 0 ? n1 : n2); } Console.WriteLine(SmallerNum("21", "56")); }
public void TestMethod1() { Orange orange = new Orange(true); Orange unpeeledOrange = new Orange(false); Console.WriteLine(orange.IsPeeled); Console.WriteLine(unpeeledOrange.IsPeeled); Console.WriteLine(orange.Peel()); Console.WriteLine(unpeeledOrange.Peel()); Banana banana = new Banana(); List <IFruit> fruitBasket = new List <IFruit>(); fruitBasket.Add(banana); fruitBasket.Add(orange); }
public void FruitTest() { Orange foo = new Orange(true); Orange unpeeledOrange = new Orange(false); Console.WriteLine(foo.IsPeeled); Console.WriteLine(unpeeledOrange.IsPeeled); Console.WriteLine(foo.Peel()); Console.WriteLine(unpeeledOrange.Peel()); Banana banana = new Banana(); List <IFruit> fruitBasket = new List <IFruit>(); fruitBasket.Add(banana); fruitBasket.Add(foo); fruitBasket.ToArray(); }
public void FruitTest() { Orange orange = new Orange(true); Orange unpeeledOrange = new Orange(false); Console.WriteLine(orange.IsPeeled); Console.WriteLine(unpeeledOrange.IsPeeled); Console.WriteLine(orange.Peel()); Console.WriteLine(unpeeledOrange.Peel()); Banana jake = new Banana(); List <IFruit> fruitBasket = new List <IFruit>(); fruitBasket.Add(jake); fruitBasket.Add(orange); fruitBasket.Add(unpeeledOrange); }