Esempio n. 1
0
        static void Main(string[] args)
        {
            Account acc = new SBAccount {
                AccountNo = 1111, AccountName = "Phaniraj"
            };                                                                        //Dependency inversion principle...

            acc.Credit(50000);
            acc.CalculateInterest();
            Console.WriteLine("The Current balance is " + acc.Balance);
        }
        //Abstract classes are incomplete, U cannot instantiate them..U should use Runtime Polymorphism to work those objects
        static void Main(string[] args)
        {
            Account acc = new SBAccount();

            acc.AccountNo    = 34244;
            acc.CustomerName = "Phaniraj";
            acc.CreditAmount(12000);
            acc.DebitAmount(500);
            acc.CalculateInterest();//Calculate interest based on SBAccc..
            //Console.WriteLine($"The Current balance is {acc.Balance.ToString("C")}");
            Console.WriteLine($"The Current Balance is {acc.Balance:C}");
            Console.WriteLine($"The Current Balance is {acc.Balance.ToString("C", new CultureInfo("EN-US"))}");
        }
        static void Main(string[] args)
        {
            //Use the object of the Abstract class but instantiate it to the Derived...
            Account acc = new SBAccount();

            acc.CreditAmount(5000);
            acc.CalculateInterest();
            Console.WriteLine("The Current balance is " + acc.Balance);

            acc = new RDAccount();
            acc.CreditAmount(5000);
            acc.CalculateInterest();
            Console.WriteLine("The Current balance is " + acc.Balance);
        }