开发者

Java generics in inheritance in Android

开发者 https://www.devze.com 2023-04-06 23:19 出处:网络
My intention is to set create a class with this type of inheritance: public class BaseActivity<T> extends <T extends Activity>开发者_开发技巧

My intention is to set create a class with this type of inheritance:

public class BaseActivity<T> extends <T extends Activity>开发者_开发技巧 

but of course this inheritance syntax doesn't compile. Any alternative suggestion where I can arbitrarily select a Tab or Map Activity to be the base of other Activity classes whose override behavior is necessary?


You can't do that, but you can do:

public class BaseActivity<T extends Activity> extends Activity

That's not exactly what I think you mean to express, but perhaps close?

0

精彩评论

暂无评论...
验证码 换一张
取 消