#!/usr/bin/python
# -*- coding:utf-8 -*- #建造者基类
class PersonBuilder():
def BuildHead(self):
pass def BuildBody(self):
pass def BuildArm(self):
pass def BuildLeg(self):
pass #胖子
class PersonFatBuilder(PersonBuilder):
type = u'胖子'
def BuildHead(self):
print u'构建%s的头' % self.type def BuildBody(self):
print u'构建%s的身体' % self.type def BuildArm(self):
print u'构建%s的手' % self.type def BuildLeg(self):
print u'构建%s的脚' % self.type #瘦子
class PersonThinBuilder(PersonBuilder):
type = u'瘦子'
def BuildHead(self):
print u'构建%s的头' % self.type def BuildBody(self):
print u'构建%s的身体' % self.type def BuildArm(self):
print u'构建%s的手' % self.type def BuildLeg(self):
print u'构建%s的脚' % self.type #指挥者
class PersonDirector():
pb = None;
def __init__(self, pb):
self.pb = pb def CreatePereson(self):
self.pb.BuildHead()
self.pb.BuildBody()
self.pb.BuildArm()
self.pb.BuildLeg() def clientUI():
pb = PersonThinBuilder()
pd = PersonDirector(pb)
pd.CreatePereson() pb = PersonFatBuilder()
pd = PersonDirector(pb)
pd.CreatePereson()
return if __name__ == '__main__':
clientUI();

最新文章

  1. ACCEPTANCE CRITERIA FOR USER STORIES
  2. Intellij 常用快捷键
  3. A trip through the Graphics Pipeline 2011_07_Z/Stencil processing, 3 different ways
  4. 部署ganglia3.7
  5. day3 python 集合 文件
  6. UVa 297 - Quadtrees
  7. zabbix oracle监控插件orabbix部署安装
  8. Linux shell (一)
  9. javascript之尺寸,位置,溢出
  10. ASP.NET Core 实战:使用 Docker 容器化部署 ASP.NET Core + MySQL + Nginx
  11. widows10 安装1803 版本后不能访问网络上的机器解决方法
  12. vue结构详解
  13. SpringMVC 使用 MultipartFile 实现文件上传
  14. java_字段声明
  15. 第一篇:服务的注册与发现Eureka(Finchley版本)
  16. xml文件里 用js语句获取 当前时间
  17. 03.设计模式_抽象工厂模式(Abstract Fcatory)
  18. swift - 正则表达式
  19. C++11 使用 std::async创建异步程序
  20. 如何在 Django 中保证并发的数据一致性

热门文章

  1. Python3练习题系列(08)——代码阅读方法及字典跳转表理解
  2. 吐槽下intellij idea 2018.3这个版本
  3. perl debug
  4. keybd_event 被 SendInput 替代
  5. Tensorflow 之finetune微调模型方法&&不同层上设置不同的学习率
  6. javascript数据类型的判断
  7. Linux性能分析流程图
  8. SpringBoot中配置起动时的数据库初始化角本
  9. Long polling failed, will retry in 16 seconds. appId: zeus-guard, cluster: default, namespaces: application, long polling url: null, reason: Get config services failed from···
  10. C# 读写文件摘要