Scala 的密封抽象与抽象类 [英] Scala's sealed abstract vs abstract class

查看:33
本文介绍了Scala 的密封抽象与抽象类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sealed abstractabstract 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆