公共界面,内部功能

时间:2017-04-28 15:30:22

标签: design-patterns interface

我有一个目前公开的界面。这将作为类型的表示传递给客户端(相同的应用程序,但我无法修改更改类型之外的调用代码)。

A - > B.GetIntrerface();

A - > B.SendInterface(A.InterfaceIGot);

基本上就是我在这里说的。

考虑到这一点,如果我想拥有内部功能(以便调用者无法看到它),并且我不想将具体类传递给调用者,是否有支持此功能的设计模式?

我可以这样做:

A.otherInterface = A.instanceOfB.GetInterface();
instanceOfB.SendInterface(A.otherInterface);

其他接口是公开的。

内部SendInterface

interfacePassedIn.DoSomethingInternal();

我知道我可以垂头丧气,但看起来很混乱。是否有既定的设计模式?

谢谢!

0 个答案:

没有答案
相关问题