Пример #1
0
 private void printHeight(Toy toy)
 {
     if (toy is IHasHeight)
     {
         IHasHeight temp = (IHasHeight)(toy);
         System.Console.WriteLine("Height: " + temp.Height);
     }
 }
Пример #2
0
 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;
             }
         }
     }
 }