Пример #1
0
        static void Main(string[] args)
        {
            SuperHero superHero = new SuperHero("Super Dude", 20);

            superHero.AddPower("Spider Climbing", 50);
            superHero.AddPower("Webcasting", 40);
            Console.WriteLine(superHero.ToString());

            SuperVillain superVillain = new SuperVillain("Super Dude LV2", 20);

            superVillain.AddPower("Spider Climbing LV2", 50);
            superVillain.AddPower("Webcasting LV2", 40);
            Console.WriteLine(superVillain.ToString());

            if (superHero is SuperHero)
            {
                Console.WriteLine("super dude is definitely a superhero!");
            }
            else
            {
                Console.WriteLine("super dude is not a hero!");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            SuperHero superHero = new SuperHero("SuperHero Dude", 20);

            superHero.Powers.Add(new Power("Teleportation", 50));
            superHero.Powers.Add(new Power("Phasing", 40));
            superHero.Powers.Add(new Power("Invisibility", 30));
            Console.WriteLine(superHero.ToString());
            Console.WriteLine("Karma: " + superHero.Karma);
            Console.WriteLine();

            SuperVillain superVillain = new SuperVillain("SuperVillain Dude", 20);

            superVillain.AddPower("Shadow Casting", 50);
            superVillain.AddPower("Mind Control", 40);
            superVillain.AddPower("Combat Senses", 30);
            Console.WriteLine(superVillain.ToString());
            Console.WriteLine("Malice: " + superVillain.Malice);

            if (superHero is SuperHero)
            {
                Console.WriteLine("Super Dude is definitely a SuperHero");
            }
        }