What is the difference between sealed abstract
and abstract
Scala class?
相关问题
- Unusual use of the new keyword
- What uses more memory in c++? An 2 ints or 2 funct
- Get Runtime Type picked by implicit evidence
- How Does WebSphere Choose the Classloading Order i
- What's the point of nonfinal singleton objects
相关文章
- Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现
- RDF libraries for Scala [closed]
- Why is my Dispatching on Actors scaled down in Akk
- How do you run cucumber with Scala 2.11 and sbt 0.
- GRPC: make high-throughput client in Java/Scala
- NameError: name 'self' is not defined, eve
- Setting up multiple test folders in a SBT project
- Testing request with CSRF Token in Play framework
As answered, all directly inheriting subclasses of a sealed class (abstract or not) must be in the same file. A practical consequence of this is that the compiler can warn if the pattern match is incomplete. For instance:
If the
Tree
issealed
, then the compiler warns unless that last line is uncommented.The difference is that all subclasses of a sealed class (whether it's abstract or not) must be in the same file as the sealed class.