[英]Implement generic interface in a generic abstract class
Interface-界面-
interface Service<T>
{
void foo(T t);
}
I want to create an abstract class that implements the Service
interface.我想创建一个实现Service
接口的抽象类。 I don't want to provide the implementation for T
ie generic .我不想提供T
ie generic的实现。 That I will do in another child class of the abstract class.我将在抽象类的另一个子类中进行。
How should I declare an abstract class with generic in it?我应该如何声明一个带有泛型的抽象类?
abstract class AbstractService implements Service<T>
is not cool with java.用java不酷。
abstract class AbstractService<T> implements Service<T>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.