Abstract and final class defined in the same Scala class

I know that Scala allows both abstract, and finalin the same class.
What is the use of this? Example:

final abstract class Parent { ... }

The above code compiles in order. When comparing this with Java, this is unacceptable. Also, is there any logic for defining both?

+4
source share
1 answer

abstractprohibits instantiation ( new...), whereas finalprohibits subclassing
( new Class { ... }), so they both serve a different purpose here.

Scala Int, JVM. , JVM , .
, (, val value: Int = 5).

+4

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


All Articles