题目详情

用于增加对象功能的设计模式是( )

  • A.Adapter
  • B.Decorator
  • C.Delegation
  • D.Proxy

正确答案及解析

正确答案
B
解析

本题考查常见设计模式的功能,备选答案中除Delegation,其它均为经典设计模式。

适配器(adapter)模式。适配器模式将一个接口转换成客户希望的另一个接口,从而使接口不兼容的那些类可以一起工作。适配器模式既可以作为类结构型模式,也可以作为对象结构型模式。在类适配器模式中,通过使用一个具体类将适配者适配到目标接口中;在对象适配器模式中,一个适配器可以将多个不同的适配者适配到同一个目标。装饰(decorator)模式。装饰模式是一种对象结构型模式,可动态地给一个对象增加一些额外的职责,就增加对象功能来说,装饰模式比生成子类实现更为灵活。通过装饰模式,可以在不影响其他对象的情况下,以动态、透明的方式给单个对象添加职责;当需要动态地给一个对象增加功能,这些功能可以再动态地被撤销时可使用装饰模式;当不能采用生成子类的方法进行扩充时也可使用装饰模式。

代理(proxy)模式。代理模式是一种对象结构型模式,可为某个对象提供一个代理,并由代理对象控制对原对象的引用。代理模式能够协调调用者和被调用者,能够在一定程度上降低系统的耦合度,其缺点是请求的处理速度会变慢,并且实现代理模式需要额外的工作。

包含此试题的试卷

你可能感兴趣的试题

单选题

Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.

  • A.Artificial Intelligence
  • B.Cloud Computing
  • C.Internet of Things
  • D.Big Data
查看答案
单选题

In project human resource management , ( )is not a source of power for the project manager.

  • A.referent power
  • B.expert power
  • C.reward power
  • D.audit power
查看答案
单选题

At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.

  • A.detail feasibility analysis
  • B.opportunity analysis
  • C.economic feasibility analysis
  • D.risk analysis
查看答案
单选题

( )is a grid that shows the project resources assigned to each work package.

  • A.Stakeholder engagement assessment matrix
  • B.Requirements traceability matrix
  • C.Probability and impact matrix
  • D.Responsibility assignment matrix
查看答案
单选题

Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.

  • A.digital
  • B.networking
  • C.intelligentize
  • D.informatization
查看答案

相关题库更多 +