ZeroC ICE:接口和 类 有什么区别?

ZeroC ICE : what's the difference between interfaces and classes?

我目前正在研究 ZeroC ICE,但我一点都不明白:接口和 class 之间的真正区别是什么? 我知道一个接口不能有属性,只能有操作,但我不明白为什么我们只使用操作时要使用接口而不是classes。 在Ice的文档中,有这样的解释:https://doc.zeroc.com/display/Ice36/Architectural+Implications+of+Classes#ArchitecturalImplicationsofClasses-ClasseswithOperations(见类 with operations)。

"But, keep in mind that, once you use classes with operations, you are, in effect, using client-side native code and, therefore, you can no longer enjoy the implementation transparencies that are provided by interfaces".

哪个实现透明度? 有人可以解释一下吗?

谢谢。

接口从不在客户端实例化。

类 通常是 return 值,需要在客户端实例化,这需要在客户端有一个可用的实现。因此,您需要依赖客户端的正确实现。

如果您仅将 类 用作接口,那么 afaik 没有区别。