将子类方法提取到抽象超类时,用什么替换子类方法中的 "this"?

What to replace "this" in subclass methods with, when extracting them to an abstract superclass?

我有两个 Android 活动 A 和 B,它们有很多共同的方法。这些方法在其方法实现中使用 this。我现在将这些活动抽象为一个扩展 Activity 的抽象超类。

我应该保留超类方法中的 this 还是我需要将其更改为其他内容以确保将正确的上下文传递给适当的方法?如果我需要将 this 更改为其他内容,请告诉我应该用什么替换它?

Should I leave the this as it is in the superclass's methods or do I need to change it to something else to ensure the right context is passed to the appropriate methods?

this指当前instance/object。既然abstract类无法实例化,那么剩下的唯一可能就是具体实现了。所以你不需要替换 this