static void Main(string[] args) { Console.WriteLine("**** Fun with Static Data ****"); SavingAccount s1 = new SavingAccount(50); SavingAccount s2 = new SavingAccount(100); Console.WriteLine("Interest Rate is:{0}", SavingAccount.GetInterestRate()); SavingAccount s3 = new SavingAccount(10000.75); Console.WriteLine("Interest Rate is:{0}", SavingAccount.GetInterestRate()); Console.ReadLine(); }
static void Main(string[] args) { SavingAccount s1 = new SavingAccount(50); Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate()); SavingAccount.SetInterestRate(0.08); SavingAccount s2 = new SavingAccount(100); Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate()); SavingAccount s3 = new SavingAccount(10000.75); Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate()); }
static void Main(string[] args) { Console.WriteLine("***** Fun with Static Data *****\n"); SavingAccount s1 = new SavingAccount(50); SavingAccount s2 = new SavingAccount(100); // Print the current interest rate. Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate()); // Make new object, this does NOT 'reset' the interest rate. SavingAccount s3 = new SavingAccount(10000.75); Console.WriteLine("Interest Rate is: {0}", SavingAccount.GetInterestRate()); Console.ReadLine(); }