Generics: Inheriting from an abstract class that implements an interface

前端 未结 4 1338
臣服心动
臣服心动 2020-12-29 05:31

I have the following interface:

public interface SingleRecordInterface {
    public void insert(T object);
}

I have the abstract c

4条回答
  •  再見小時候
    2020-12-29 06:19

    You need to make your abstract class generic as well:

    public abstract class AbstractEntry implements SingleRecordInterface {
    }
    

    Then for your concrete class:

    public class SpecificEntry extends AbstractEntry {
    }
    

提交回复
热议问题