sam
08/01/2020, 4:13 PMclass Time private constructor(val hours: Int, val minutes: Int, val seconds: Int) {
companion object {
operator fun invoke(hours: Int, minutes: Int, seconds: Int): Time {
return Time(1, 2, 3) // do your overflow stuff here
}
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Time
if (hours != other.hours) return false
if (minutes != other.minutes) return false
if (seconds != other.seconds) return false
return true
}
override fun hashCode(): Int {
var result = hours
result = 31 * result + minutes
result = 31 * result + seconds
return result
}
}