本文介绍了多态对象层次结构的构建器模式:可能用Java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个接口层次结构, c ParentBuilder 当然是 ParentBuilder ,而不是说, Child1Builder 旨在维护流利的通话链接。

As you can see, the ParentBuilder type expects to be cooperating with a derived type to allow it to return a properly-typed instance. Its own this reference won't due, because the type of this within ParentBuilder is, of course, ParentBuilder, and not, say, Child1Builder as intended to maintain the "fluent" call chaining.

我欠 getThis()技巧到。

这篇关于多态对象层次结构的构建器模式:可能用Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 01:50