Using a class's properties without having to write its name down every time

前端 未结 0 1754
清酒与你
清酒与你 2021-01-27 09:04
fun eval(expr: Expr): Int =
        when (expr) {
            is Num -> expr.value
            is Sum -> expr.left + expr.right
        }

interface Expr
class Num         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题