Home > front end >  Class does not show override methods from inheritance class
Class does not show override methods from inheritance class

Time:06-21

I have created class ScreenDrawer that has 3 functions. And I have a class ChatsScreen that inherits the ScreenDrawer. But for some reason when I click Ctrl O in Android Studio I don't see methods that I can override as I can do in MainActivity that extends AppCompatActivity.

So how I need to organize classes so my ChatsScreen could see ScreenDrawer methods by inherit it.

Here is my ChatsScreen

enter image description here

Here is my ScreenDrawer that need to be extended by ChatsScreen

enter image description here

Now I got this in methods

enter image description here

CodePudding user response:

Any methods you want to override have to be open too (or already overridden, or abstract). Check the docs

The override modifier is required for Circle.draw(). If it were missing, the compiler would complain. If there is no open modifier on a function, like Shape.fill(), declaring a method with the same signature in a subclass is not allowed, either with override or without it.

  • Related