private void printHeight(Toy toy) { if (toy is IHasHeight) { IHasHeight temp = (IHasHeight)(toy); System.Console.WriteLine("Height: " + temp.Height); } }
public void ChangeHeight(double value) { if (toysList.Count > 1) { foreach (Toy toy in toysList) { if (toy is IHasHeight) { IHasHeight temp = (IHasHeight)(toy); temp.Height = value; } } } }