コード例 #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());

            Console.WriteLine("**********Add Super Villains*************");
            SuperVillain superVillain = new SuperVillain("Maleficent", 30);

            superVillain.AddPower("Casting Spell", 30);
            superVillain.AddPower("Flying", 40);
            Console.WriteLine(superVillain.ToString());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SuperHuman superHuman = new SuperHuman("Super Dude");

            superHuman.Powers.Add(new Power("Spider Cloning", 50));
            superHuman.Powers.Add(new Power("Teleporting", 40));
            Console.WriteLine(superHuman.ToString());

            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);
        }