示例#1
0
文件: App.cs 项目: dahlanders/skolan
        public void Run()
        {
            Console.WriteLine();

            var b1 = new Book();

            b1.SetIsbn("XXXXX-XXXX");
            b1.SetAuthor("Kalle");
            b1.SetNrOfPages(400);
            b1.SetProductId(1234);

            Console.WriteLine($"Info om boken:");
            Console.WriteLine($"* ISBN={b1.GetIsbn()}");
            Console.WriteLine($"* Författare={b1.GetAuthor()}");
            Console.WriteLine($"* Antal sidor={b1.GetNrOfPages()}");
            Console.WriteLine($"* Vikt={b1.WeightInGram()} gram");
            Console.WriteLine($"* Recension={b1.Review()}");
            Console.WriteLine($"* Produktens id={b1.GetProductId()}");
            Console.WriteLine($"* Är b1 en bok? {b1 is Book}");
            Console.WriteLine($"* Är b1 en produkt? {b1 is Product}");

            var e1 = new ElectronicBook();

            e1.EmailBook("*****@*****.**");

            Console.WriteLine();
        }
示例#2
0
        public void Run()
        {
            Console.WriteLine();

            var b1 = new Book();
            var e1 = new ElectronicBook();

            b1.SetIsbn("978-3-16-148410-0");
            b1.SetAuthor("Kalle");
            b1.SetNrOfPages(400);
            b1.SetProductId(1234);

            Console.WriteLine($"Info om boken:");
            Console.WriteLine();
            Console.WriteLine($"   ISBN:             {b1.GetIsbn()}");
            Console.WriteLine($"   Författare:       {b1.GetAuthor()}");
            Console.WriteLine($"   Antal sidor:      {b1.GetNrOfPages()}");
            Console.WriteLine($"   Vikt:             {b1.WeightInGram()} gram");
            Console.WriteLine($"   Storlek:          {b1.Size()}");
            Console.WriteLine($"   Produktens id:    {b1.GetProductId()}");

            Console.WriteLine();
            Console.WriteLine($"Olika test:");
            Console.WriteLine();

            Console.WriteLine($"   Är b1 en bok?     {b1 is Book}");
            Console.WriteLine($"   Är b1 en e-bok?   {b1 is ElectronicBook}");
            Console.WriteLine($"   Är b1 en produkt? {b1 is Product}");

            Console.WriteLine();

            Console.WriteLine($"   Är e1 en bok?     {e1 is Book}");
            Console.WriteLine($"   Är e1 en e-bok?   {e1 is ElectronicBook}");
            Console.WriteLine($"   Är e1 en produkt? {e1 is Product}");

            Console.WriteLine();
            Console.WriteLine($"Anrop:");
            Console.WriteLine();
            e1.SendBookTo("*****@*****.**");

            Console.WriteLine();
        }