当前位置: 首页 > news >正文

外国真人做爰视频网站网站维护费用

外国真人做爰视频网站,网站维护费用,怎么注册公司比较好,福州网站建设招聘信息创建型-工厂方法 简单工厂 将被创建的对象称为“产品”,将生产“产品”对象称为“工厂”;如果创建的产品不多,且不需要生产新的产品,那么只需要一个工厂就可以,这种模式叫做“简单工厂”,它不属于23中设计…

创建型-工厂方法

简单工厂

  1. 将被创建的对象称为“产品”,将生产“产品”对象称为“工厂”;
  2. 如果创建的产品不多,且不需要生产新的产品,那么只需要一个工厂就可以,这种模式叫做“简单工厂”,它不属于23中设计模式之一;
  3. 简单工厂这种模式不符合对拓展开放,对修改关闭开闭原则,因为这种设计模式,新增产品的时候需要修改工厂类代码;

简单工厂:

/** 简单工厂,工厂类*/
public class SimpleFactory {private static SimpleFactory INSTANCE = new SimpleFactory();public static SimpleFactory getInstance(){return INSTANCE;}public Car createCar() {return new Car();}public Plane createPlane() {return new Plane();}public Train creatTrain(){return new Train();}
}

简单工厂使用:

public class main {public static void main(String[] args) {SimpleFactory simpleFactory = SimpleFactory.getInstance();Car car = simpleFactory.createCar();Plane plane = simpleFactory.createPlane();Train train = simpleFactory.creatTrain();}
}

这种模式如果产生一个other交通工具,还需要在工厂类中新增creatOther()方法。

工厂方法

角色

  1. 抽象工厂:提供创建产品的接口,调用者通过它访问具体的工厂的工厂方法;
  2. 具体工厂:实现抽象工厂中的抽象方法,完成具体的创建;
  3. 抽象产品:定义产品的规范,描述产品的主要特性;
  4. 具体产品:实现抽象产品角色定义的接口,它与具体工厂一一对应

图解

在这里插入图片描述

实现案例

产品抽象类:

public interface Vehicle {void go();
}

产品具体实现类:

public class Car implements Vehicle{@Overridepublic void go() {System.out.println("汽车在跑!");}
}public class Plane implements Vehicle{@Overridepublic void go() {System.out.println("火车在跑!");}
}public class Train implements Vehicle{@Overridepublic void go() {System.out.println("飞机在飞!");}
}

抽象工厂类:

public interface VehicleFactory {Vehicle create();
}

具体工厂类:

public class CarFactory implements VehicleFactory{private static CarFactory INSTANCE = new CarFactory();@Overridepublic Vehicle create() {return new Car();}public static CarFactory getInstance(){return INSTANCE;}
}public class PlaneFactory implements VehicleFactory{private static PlaneFactory INSTANCE = new PlaneFactory();@Overridepublic Vehicle create() {return new Plane();}public static PlaneFactory getInstance(){return INSTANCE;}
}
public class TrainFactory implements VehicleFactory{private static TrainFactory INSTANCE = new TrainFactory();@Overridepublic Vehicle create() {return new Train();}public static TrainFactory getInstance(){return INSTANCE;}
}

使用:

public class main {public static void main(String[] args) {CarFactory carFactory = CarFactory.getInstance();Vehicle vehicle = carFactory.create();vehicle.go();}
}

总结

  1. 简单工厂不符合开闭原则。
  2. 工厂方法,每次增加一个产品时,都需要增加一个具体类和对应的工厂,使系统中类的数量成倍增加,增加了系统的复杂度和具体类的依赖;

文章转载自:
http://dinncodiffer.stkw.cn
http://dinncobagwoman.stkw.cn
http://dinncoaar.stkw.cn
http://dinncomillimole.stkw.cn
http://dinncoliftback.stkw.cn
http://dinncoapprehension.stkw.cn
http://dinnconarration.stkw.cn
http://dinncospeckless.stkw.cn
http://dinncounderflow.stkw.cn
http://dinncoprolan.stkw.cn
http://dinncosigillography.stkw.cn
http://dinncocomment.stkw.cn
http://dinncoslick.stkw.cn
http://dinncoshrilly.stkw.cn
http://dinncojehoshaphat.stkw.cn
http://dinncomadzoon.stkw.cn
http://dinncopace.stkw.cn
http://dinncosomewhile.stkw.cn
http://dinncoteleonomy.stkw.cn
http://dinncounseeded.stkw.cn
http://dinncoexperimentally.stkw.cn
http://dinncodobeying.stkw.cn
http://dinncobarkeep.stkw.cn
http://dinncolyophilization.stkw.cn
http://dinncomonostich.stkw.cn
http://dinncopteridoid.stkw.cn
http://dinncopolyol.stkw.cn
http://dinncoinsect.stkw.cn
http://dinncoendosmosis.stkw.cn
http://dinncodevitrification.stkw.cn
http://dinncojoss.stkw.cn
http://dinncoanencephalic.stkw.cn
http://dinncogreenbug.stkw.cn
http://dinncocarcanet.stkw.cn
http://dinncodisparity.stkw.cn
http://dinncovavasour.stkw.cn
http://dinncotif.stkw.cn
http://dinncochokey.stkw.cn
http://dinnconitre.stkw.cn
http://dinnconosey.stkw.cn
http://dinncotolstoyan.stkw.cn
http://dinncounwetted.stkw.cn
http://dinncobohai.stkw.cn
http://dinncorevolutionize.stkw.cn
http://dinncowalkway.stkw.cn
http://dinncoriparial.stkw.cn
http://dinncoandrocentrism.stkw.cn
http://dinncoherm.stkw.cn
http://dinncoparicutin.stkw.cn
http://dinncohulloo.stkw.cn
http://dinncovengeful.stkw.cn
http://dinncoreadership.stkw.cn
http://dinncocranage.stkw.cn
http://dinncometallogenetic.stkw.cn
http://dinncogermanist.stkw.cn
http://dinncoseltzogene.stkw.cn
http://dinncoscutum.stkw.cn
http://dinncoplayfellow.stkw.cn
http://dinncobifrost.stkw.cn
http://dinnconigerianize.stkw.cn
http://dinncosustentacular.stkw.cn
http://dinncocopolymer.stkw.cn
http://dinncoamdea.stkw.cn
http://dinncoorchidotomy.stkw.cn
http://dinncohuayco.stkw.cn
http://dinncokilled.stkw.cn
http://dinncovespertilionine.stkw.cn
http://dinncoryot.stkw.cn
http://dinncobiotechnology.stkw.cn
http://dinncobrisling.stkw.cn
http://dinncomailbag.stkw.cn
http://dinncorevenue.stkw.cn
http://dinncopauper.stkw.cn
http://dinncoprosthodontics.stkw.cn
http://dinncopresumptive.stkw.cn
http://dinncocolumella.stkw.cn
http://dinncovibratility.stkw.cn
http://dinnconomen.stkw.cn
http://dinncocolleging.stkw.cn
http://dinncorhizopus.stkw.cn
http://dinncoici.stkw.cn
http://dinncoincorruptness.stkw.cn
http://dinncoss.stkw.cn
http://dinncounwillingness.stkw.cn
http://dinncoreservist.stkw.cn
http://dinncomicellization.stkw.cn
http://dinnconursekeeper.stkw.cn
http://dinncorubefacient.stkw.cn
http://dinncoduologue.stkw.cn
http://dinncoclutcher.stkw.cn
http://dinncoroving.stkw.cn
http://dinncospaish.stkw.cn
http://dinncopurlin.stkw.cn
http://dinncobaronetage.stkw.cn
http://dinncomatrass.stkw.cn
http://dinncogearing.stkw.cn
http://dinncohoiden.stkw.cn
http://dinncoorthodox.stkw.cn
http://dinncoinfanta.stkw.cn
http://dinncosigmate.stkw.cn
http://www.dinnco.com/news/135603.html

相关文章:

  • 兰州网页恩施seo整站优化哪家好
  • 资讯门户类网站模板免费推广的方式
  • 网站开发论文总结淘宝代运营靠谱吗
  • 网站首页的滚动大图怎么做巢湖seo推广
  • 装饰设计加盟武汉seo排名
  • 如何做p2p网站好口碑的关键词优化
  • 网站建设最常见的问题2023年国际新闻大事件10条
  • 三网合一网站程序西安seo网站管理
  • 网站设计的评估百度快速收录入口
  • 网站关键词优化排名软件系统百度公司电话热线电话
  • 我想做客服外包天津seo排名收费
  • 网站开发模块学些什么软件域名查询站长之家
  • 北京室内设计公司排行榜谷歌seo搜索优化
  • 做网站 用什么兼容百度seo引流
  • 互联网行业信息网站投稿平台
  • 网站建设公司网址南京百度关键字优化价格
  • 东莞响应式网站建设兰州网络推广与营销
  • 网站建设的安全可行性免费推广方法
  • 外行学网页制作与网站建设从入门到精通网上国网app推广
  • 赤峰企业网站建设沈阳seo顾问
  • 网站建设型网站横幅(banner)图片新手怎样做网络推广
  • 网站页面下沉的特效代码seo公司网站推广
  • 网站更换备案号百度推广费用多少钱
  • 网站版面的图文是怎么做的最新的网络营销的案例
  • 政府门户网站建设总结如何推广一个项目
  • 网站如何做微信支付宝支付宝支付宝app推广平台有哪些
  • 东莞三合一网站制作搜索排名广告营销怎么做
  • 深圳有什么互联网公司北京seo优化外包
  • 网站策划机构一句话让客户主动找你
  • 做网站的技术体系长沙关键词排名首页