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
        private static void Main(string[] args)
        {
            // This is my first GIT program.
            // Here we trying to develop a requirment using Factory method pattern.
            AbstractCourse objCourse = CourseFactory.CreateCourse();

            Console.ReadKey();


            // new comment
        }