我正在尝试学习Kotlin,并在kotlin中创建了一个简单的类,在其构造函数中使用两个int,然后添加它们.这些int可以为null.
I am receiving compilation error as:
None of the following functions can be called with the arguments supplied:
public final operator fun plus(other: Byte): Int defined in kotlin.Int
public final operator fun plus(other: Double): Double defined in kotlin.Int
public final operator fun plus(other: Float): Float defined in kotlin.Int
public final operator fun plus(other: Int): Int defined in kotlin.Int
public final operator fun plus(other: Long): Long defined in kotlin.Int
public final operator fun plus(other: Short): Int defined in kotlin.Int
Run Code Online (Sandbox Code Playgroud)
我的号码加法器类如下: …