开发者

Is it acceptable for an interface definition to contain references to other interfaces?

开发者 https://www.devze.com 2023-01-16 05:55 出处:网络
I was looking at the definition of Spring\'s PlatformTransactionManager which contains references to TransactionStatus and TransactionDefinition, two other interfaces.

I was looking at the definition of Spring's PlatformTransactionManager which contains references to TransactionStatus and TransactionDefinition, two other interfaces.

Is this 开发者_如何学Cacceptable in general, an interface's definition containing references to other interfaces? When is it useful?


Yes it's acceptable. Why wouldn't it be ?

It's even better to have references to Interfaces instead of concrete classes for what it worth.


It's absolutely acceptable. Sometimes types need to refer to other types - and if those types in turn represent potentially complex services, it's useful to be able to abstract out a general type, often in the form of an interface.


Its possible... Thats one of the key aspects in implementing multiple inheritence


Yes. It is possible. I can not think of any scenario where it may create any problems.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号