[英]How to interface can extends 2 with that extends the same but with different generic parameters in java?
[英]Same class with different extends
我有两个具有相同内容的类,但第一类适用于android版本<honeycomb
并扩展了片段的支持库。 第二类,其版本高于honeycomb
并扩展了本地sdk库。 可能只有一个类文件,但又以某种方式将其扩展了吗?
您不能,但是它们两个都可以实现相同的接口,并且想要使用这两个类的类将仅需使用该接口(这称为“ Strategy
模式”)。 根据操作系统的版本,在要求该接口时,您将返回一个类或另一个类( Factory
Pattern)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.