Click here to Skip to main content
15,884,837 members
Articles / Web Development / ASP.NET

From No Factory to Factory Method

Rate me:
Please Sign up or sign in to vote.
4.88/5 (161 votes)
23 Nov 2012CPOL11 min read 242.6K   2.8K   228  
This article will tell about the very known design pattern "Factory Pattern" used in the programming.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CourseLibrary;

namespace FactoryMethod
{
	public abstract class AbstractCourseFactory
	{
		public AbstractCourse CreateCourse(string ScheduleType)
		{
			AbstractCourse objCourse = this.GetCourse(ScheduleType);		
			objCourse.CreateCourseMaterial();
			objCourse.CreateSchedule();
			return objCourse;
		}
		public abstract AbstractCourse GetCourse(string ScheduleType);
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Just Compile
India India
Learning is fun but teaching is awesome.

Who I am? Trainer + consultant + Developer/Architect + Director of Just Compile

My Company - Just Compile

I can be seen in, @sukeshmarla or Facebook

Comments and Discussions