In Scala, can internal methods be overwritten in subclasses?

For example, in the following

class Base { def test() { def internal() { println("base internal") } } } 

Is it possible for an internal record to be overwritten in a subclass?

+6
source share
2 answers

Not. Internal methods are virtually confidential.

+8
source

To complete Daniel's answer: if you want to override the internal method, you must declare it as protected directly under Base .

In fact, the internal method can be considered as a block of the method itself.

+2
source

Source: https://habr.com/ru/post/896019/


All Articles