Ejemplo n.º 1
0
        public static AbstractCourse CreateCourse()
        {
            // Think that this is Business logic

            AbstractCourse objCourse = null;

            Console.WriteLine("we are doing simple factory pattern");
            switch (Console.ReadLine())
            {
            case "J":
                objCourse = new JavaCourse();
                break;

            case "N":
                objCourse = new NetCourse();
                break;

            default:
                Console.WriteLine("Invalid input");
                break;
            }

            // Lets see which course seleted
            objCourse.CreateCourseMaterial();
            objCourse.CreateSchedule();
            objCourse.ShowCourseName();
            return(objCourse);
        }
Ejemplo n.º 2
0
        public static AbstractCourse CreateCourse()
        {
            // Think that this is Business logic

            AbstractCourse objCourse = null;
            Console.WriteLine("we are doing simple factory pattern");
            switch (Console.ReadLine())
            {
                case "J":
                    objCourse = new JavaCourse();
                    break;
                case "N":
                    objCourse = new NetCourse();
                    break;
                default:
                    Console.WriteLine("Invalid input");
                    break;
            }

            // Lets see which course seleted
            objCourse.CreateCourseMaterial();
            objCourse.CreateSchedule();
            objCourse.ShowCourseName();
            return objCourse;
        }