Scala的密封抽象类和抽象类 [英] Scala's sealed abstract vs abstract class
本文介绍了Scala的密封抽象类和抽象类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
密封抽象
和抽象
Scala类之间有什么区别?
<不同之处在于,一个被封装的类的所有子类(无论是否是抽象的)都必须与被封装类相同的文件。
What is the difference between sealed abstract
and abstract
Scala class?
解决方案
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.
这篇关于Scala的密封抽象类和抽象类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文