Does marking a class as final also make every function final?

前端 未结 1 1504
梦谈多话
梦谈多话 2021-01-19 03:59

As the title says, I\'m wondering if by making a class final, and letting the compiler do it\'s speed optimisation, I need to also mark functions as final or they become fin

相关标签:
1条回答
  • 2021-01-19 04:29

    final applied to a class makes it not subclassable, so in no case you can override any function or property, because in order to do that you have to create a subclass. So yes, it indirectly applies to all of its members

    0 讨论(0)
提交回复
热议问题