Пример #1
0
        static void Main(string[] args)
        {
            BankAccountProtected[] bankAccts = new BankAccountProtected[2];
            bankAccts[0] = new SavingsAccount();
            bankAccts[1] = new CheckingAccount();

            foreach (BankAccountProtected acct in bankAccts)
            {
                // call public method, which invokes protected virtual methods
                acct.CloseAccount();
            }

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            BankAccountProtected[] bankAccts = new BankAccountProtected[2];
            bankAccts[0] = new SavingsAccount();
            bankAccts[1] = new CheckingAccount();

            foreach (BankAccountProtected acct in bankAccts)
            {
                // call public method, which invokes protected virtual methods
                acct.CloseAccount();
            }

            Console.ReadKey();
        }