示例#1
0
        static void Main(string[] args)
        {
            Book            book            = new Book();
            CoffeeTableBook coffeeTableBook = new CoffeeTableBook();
            TextBook        textBook        = new TextBook();
            Test            test            = new Test();

            test.ISBN = 1;

            book.Price            = 30;
            coffeeTableBook.Price = 10;
            textBook.Price        = 30;

            book.ISBN            = 1;
            coffeeTableBook.ISBN = 2;
            textBook.ISBN        = 1;

            book.Author            = "jos";
            coffeeTableBook.Author = "fien";
            textBook.Author        = "jos";

            book.Title            = "how to program";
            coffeeTableBook.Title = "how to sing";
            textBook.Title        = "how to program";

            Book testbook = Book.TelOp(coffeeTableBook, book);

            Console.WriteLine($"{testbook.ISBN} and {testbook} are equal");

            if (book.Equals(textBook))
            {
                Console.WriteLine($"{textBook} and {book} are equal");
            }
            else
            {
                Console.WriteLine($"{textBook} and {book} are not equal");
            }
        }
        static void Main(string[] args)
        {
            Book boek1 = new Book();

            boek1.Title  = "The Shining";
            boek1.Author = "Stephen King";
            boek1.ISBN   = 05848152;
            boek1.Price  = 25;
            Book boek2 = new Book();

            boek2.Title  = "The Haunting of Hill House";
            boek2.Author = "Shirley Jackson";
            boek2.ISBN   = 05848153;
            boek2.Price  = 20;
            TextBook tb = new TextBook();

            tb.Title      = "Zie Scherp";
            tb.Author     = "Tim Dams";
            tb.ISBN       = 03449664;
            tb.Price      = 15;
            tb.GradeLevel = 4;
            CoffeeTableBook ctb = new CoffeeTableBook();

            ctb.Title  = "Vlaamse Primitieven";
            ctb.Author = "Johannes De Meester";
            ctb.ISBN   = 01134685;
            ctb.Price  = 85;

            Book omnibus = boek1 + boek2;

            Console.WriteLine(omnibus);
            Console.WriteLine(tb);
            Console.WriteLine(ctb);
            Console.WriteLine(tb.Equals(ctb));


            Console.ReadLine();
        }