有谁能指出下图的含义:

C#代码也将不胜感激!
请注意,UML来自于MartinC.Robert,Martin 2006的C#中的敏捷原则、模式和实践。
在2011/6/2中添加
1)一端有三角形的实线;2)一端有三角形的虚线
于2011/6/3年度第一次添加
1)一端有箭头的实线;2)一端有箭头的虚线
下面链接中的示例,以及PersistentObject和ThirdPartyPersistentSet中的示例:
于2011/6/3年度第二次添加
PolicyLayer和PolicyServiceInterface之间的关系可以如下所示:
public class PolicyLayer
{
private PolicyServiceInterface policyServiceInterface = new PolicyServiceInterfaceImplementation();
}
class PolicyServiceInterfaceImplementation:PolicyServiceInterface {}关于
发布于 2011-06-02 13:51:25
PolicyLayer使用策略服务接口(很可能它持有一个引用),MachanismLayer实现PolicyServiceInterface
public interface IPolicyServiceInterface
{
void DoSomething();
}
public class MachanismLayer : IPolicyServiceInterface
{
public void DoSomething()
{
Console.WriteLine("MachanismLayer Do Something");
}
}
public class PolicyLayer
{
private IPolicyServiceInterface _policyServiceInterface;
public PolicyLayer(IPolicyServiceInterface policyServiceInterface)
{
_policyServiceInterface = policyServiceInterface;
}
public void DoSomethig()
{
_policyServiceInterface.DoSomething();
}
}
public class Program
{
public static void Main(string[] agrs)
{
MachanismLayer machanismLayer=new MachanismLayer();
PolicyLayer policyLayer = new PolicyLayer(machanismLayer);
policyLayer.DoSomethig();
}
}https://stackoverflow.com/questions/6215388
复制相似问题