コード例 #1
0
ファイル: MortimerPhones4.cs プロジェクト: alannet/example
 public static void Main()
 {
     GenericCustomer arabel = new Nevermore60Customer();
      arabel.Name = "Arabel Jones";
      GenericCustomer mrJones = new PayAsYouGoCustomer();
      mrJones.Name = "Ben Jones";
      GenericCustomer [] customers = new GenericCustomer[2];
      customers[0] = arabel;
      customers[0].RecordCall(TypeOfCall.CallToLandline, 20);
      customers[0].RecordCall(TypeOfCall.CallToCellPhone, 5);
      customers[1] = mrJones;
      customers[1].RecordCall(TypeOfCall.CallToLandline, 10);
      foreach (GenericCustomer nextCustomer in customers)
      {
     Console.WriteLine("{0,-20} owes ${1:F2}", nextCustomer.Name, nextCustomer.Balance);
      }
 }
コード例 #2
0
        public static void Main()
        {
            GenericCustomer arabel = new Nevermore60Customer();

            arabel.Name = "Arabel Jones";
            GenericCustomer mrJones = new PayAsYouGoCustomer();

            mrJones.Name = "Ben Jones";
            GenericCustomer [] customers = new GenericCustomer[2];
            customers[0] = arabel;
            customers[0].RecordCall(TypeOfCall.CallToLandline, 20);
            customers[0].RecordCall(TypeOfCall.CallToCellPhone, 5);
            customers[1] = mrJones;
            customers[1].RecordCall(TypeOfCall.CallToLandline, 10);
            foreach (GenericCustomer nextCustomer in customers)
            {
                Console.WriteLine("{0,-20} owes ${1:F2}", nextCustomer.Name, nextCustomer.Balance);
            }
        }