四人帮 - 定义帮助!

发布于 2024-10-02 14:55:46 字数 182 浏览 0 评论 0原文

我对以下术语有疑问......它们在战略模式方面意味着什么?

算法接口上下文

接口类

策略类

上下文

属性策略

具体策略

以及它们的层次结构......

换句话说,它们在正常策略模式中的位置是什么?

-D

I've got a question about the following terms..what do they mean in terms of a strategy pattern?

Algorithm Interface

Context Interface

Class Strategy

Class Context

Attribute Strategy

Concrete Strategy

And their hierarchy...

In other words, what would be their places in a normal strategy pattern?

-D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

油焖大侠 2024-10-09 14:55:46

用非常简单的话来说(只是为了提供一些上下文)

算法接口算法(策略)将具有的方法。

上下文接口 由将添加策略的主对象公开的方法。

类策略 实现/定义策略的类。

类上下文 将使用该策略的类。

属性策略 将作为策略的上下文类的属性。

具体策略 策略类/接口的具体实现。

以及他们的等级制度 ØØ

In very simple words ( and just to provide some context )

Algorithm Interface The methods the algorithm ( strategy ) will have.

Context Interface The methods exposed by the main object to which an strategy will be added to.

Class Strategy The class implementing/defining the strategy.

Class Context The class that will use the strategy.

Attribute Strategy The attribute of the context class that will be the strategy.

Concrete Strategy A concrete implementation of the strategy class/interface.

And their hierarchy ¬¬

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文