I have this code
class Dog<T: Comparable<T>>(private val name: Str, private val weight: T): Comparable<Dog<T>> {
override fun compareTo(other: Dog<T>): Int {
return weight.compareTo(other.weight)
}
override fun equals(other: Any?): Boolean {
if (other == null || other !is Dog<*>) return false
return name == other.name && weight == other.weight
}
}
*
means Any?
but *
is accepted and Any?
is not. Why is that?