实验一代码(共3页).docx
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《实验一代码(共3页).docx》由会员分享,可在线阅读,更多相关《实验一代码(共3页).docx(3页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上实验一:工厂模式的应用实验目的1) 掌握工厂模式(Factory)的特点2) 分析具体问题,使用工厂模式进行设计。实验内容和要求有一个OEM制造商代理做HP笔记本电脑(Laptop),后来该制造商得到了更多的品牌笔记本电脑的订单Acer,Lenovo,Dell,该OEM商发现,如果一次同时做很多个牌子的本本,有些不利于管理。利用工厂模式改善设计实验UML图实验源代码using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Factory int
2、erface ComputerFactory Computer CreateComputer(); abstract class Computer protected string computer; public abstract string newcomputer(); class Hp : Computer public override string newcomputer() return This a new Hp computer; class Dell : Computer public override string newcomputer() return This a
3、new Dell computer; class Lenovo : Computer public override string newcomputer() return This a new Lenovo computer; class Acer : Computer public override string newcomputer() return This a new Acer computer; class HpFactory : ComputerFactory public Computer CreateComputer() return new Hp(); class Del
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 实验 代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内