In general, you should always subclass a provided base implementation rather then implementing the interface yourself. This protects you from unexpected API changes and reduces your work in case of API changes (for example, when new methods are added to the interface). It also helps your software to stay compatible with future versions.
subclass a provided base implementation
最新推荐文章于 2023-12-18 17:30:35 发布
本文讨论了在软件开发中,为了确保代码的兼容性和减少因API变更带来的工作量,应优先选择继承提供的基类而非直接实现接口。这种方法有助于保护开发者免受意外的API更改影响,并使软件能够更好地与未来的版本保持兼容。
2051

被折叠的 条评论
为什么被折叠?



