コード例 #1
0
        private static void Main(string[] args)
        {
            var john = new Humanoid(new Dancing());

            Console.WriteLine(john.ShowSkill()); //print dancing

            var alex = new Humanoid(new Cooking());

            Console.WriteLine(alex.ShowSkill());//print cooking

            var bob = new Humanoid();

            Console.WriteLine(bob.ShowSkill());//print no skill is defined
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: skumargit76/JohnTheRobot
        static void Main(string[] args)
        {
            var john = new Humanoid(new Dancing());

            Console.WriteLine(john.ShowSkill()); //print dancing

            var alex = new Humanoid(new Cooking());

            Console.WriteLine(alex.ShowSkill());//print cooking

            var bob = new Humanoid();

            Console.WriteLine(bob.ShowSkill());//print no skill is defined
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }