예제 #1
0
 public void AddChild(IProfitable profitable)
 {
     if (profitable is Store)
     {
         StoreList.Add(profitable);
     }
 }
예제 #2
0
 public void RemoveChild(IProfitable profitable)
 {
     if (profitable is Store)
     {
         StoreList.Remove(profitable);
     }
 }
예제 #3
0
 public void RemoveChild(IProfitable profitable)
 {
     if (profitable is City)
     {
         CityList.Remove(profitable);
     }
 }
예제 #4
0
 public void AddChild(IProfitable profitable)
 {
     if (profitable is City)
     {
         CityList.Add(profitable);
     }
 }
예제 #5
0
 private static void PayAnnualInterest(Account[] accounts)
 {
     foreach (Account acc in accounts)
     {
         IProfitable p = acc as IProfitable;
         p?.AddInterest(1);             //if(p != null) p.AddInterest(1)
     }
 }
예제 #6
0
 private static void PayAnnualInterest(Account[] accounts)
 {
     foreach (Account acc in accounts)
     {
         IProfitable p = acc as IProfitable;
         if (p != null)
         {
             double interest = p.GetInterest(12);
             acc.Deposit(interest);
         }
     }
 }
예제 #7
0
 private static void PayAnnualInterest(Account[] group)
 {
     foreach (var acc in group)
     {
         IProfitable p = acc as IProfitable;
         if (p != null)
         {
             double i = p.GetInterest(1);
             acc.Deposit(i);
         }
     }
 }
예제 #8
0
 public void RemoveChild(IProfitable profitable)
 {
     throw new NotImplementedException();
 }