예제 #1
0
        public static IAminal Create(Aminal aminal)
        {
            switch (aminal)
            {
            case Aminal.Dog:
                return(new Dog());

            case Aminal.Cat:
                return(new Cat());

            default:
                return(null);
            }
        }
예제 #2
0
        public string WhenFactoyUseDifferentAminalWillReturnDifferentSound(Aminal aminal)
        {
            var factory = Factory.Create(aminal);

            return(factory.Sound());
        }