---
title: "第四章 简单工厂模式"
author: "crawler"
date: "2013-05-05T15:02:13Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2013-05-10T09:10:27Z"
id: 1860032
url: "https://crawler.iteye.com/blog/1860032"
---

**1.简单工厂模式**

简单工厂模式又叫做静态工厂方法模式。  
它是由一个工厂对象决定创建出不同产品类型的实例。

**2.工厂模式**

分为简单工厂模式、工厂方法模式、抽象工厂模式

   
![](http://dl.iteye.com/upload/attachment/0084/0392/3d24e23d-3d6b-3ab6-a911-5be0a5a3db11.jpg)

**3.简单工厂模式结构**

**![](http://dl.iteye.com/upload/attachment/0084/0398/5bcafa95-8da6-3e60-b408-1410e22db95a.jpg)**  
 

**4场景描述**

- 农场种植各种水果：  
  苹果：Apple  
  葡萄：Grape  
  草莓：Strawberry

**5.场景分析**

![](http://dl.iteye.com/upload/attachment/0084/0396/b02484e7-bf59-3cf8-b01e-5598a83b6c15.jpg)