I have two classes Entity
和 Account
as
abstract class Entity(
var id: String? = null,
var created: Date? = Date()) {
constructor(entity: Entity?) : this() {
fromEntity(entity)
}
fun fromEntity(entity: Entity?): Entity {
id = entity?.id
created = entity?.created
return this;
}
}
和
data class Account(
var name: String? = null,
var accountFlags: Int? = null
) : Entity() {
constructor(entity: Entity) : this() {
super(entity)
}
}
Which gives me the error
Super is not an expression, it can be only used in the left-h和 side of a dot '.'
Why cannot I do that?
以下代码将传递编译错误,但我不确定它是否正确.
constructor(entity: Entity) : this() {
super.fromEntity(entity)
}