示例#1
0
        public static void Display()
        {
            Console.WriteLine("Виртуальные методы");
            Person p1 = new Person("Bill", "Gates");

            p1.Display(); // вызов метода Display из класса Person

            Employee p2 = new Employee("Tom", "Smith", "Microsoft");

            p2.Display(); // вызов метода Display из класса Employee

            Client p3 = new Client("Anna", "Domini", "Eternity");

            p3.Display();

            Employee p4 = new Employee("Tom", "Gates", "Gigasoft");

            p4.Display();

            Console.WriteLine("Виртуальные свойства");
            LongCredit credit = new LongCredit {
                Sum = 6000
            };

            credit.Sum = 490;
            Console.WriteLine(credit.Sum);
        }
示例#2
0
    static void Main(string[] args)
    {
        LongCredit credit = new LongCredit {
            Sum = 6000
        };

        credit.Sum = 490;
        Console.WriteLine(credit.Sum);
        Console.ReadKey();
    }