more readable alternative
package ru.startandroid.kotlinsqlite.Model
class Person() {
var id: Int = 0
var name: String? = null
var email: String? = null
constructor(id : Int, name: String, email: String): this() {
this.id = id
this.name = name
this.email = email
}
}
class BetterPerson(var id: Int = 0, var name: String? = null, var email: String? = null)
And call place
package ru.startandroid.kotlinsqlite.DBHelper
import ru.startandroid.kotlinsqlite.Model.BetterPerson
import ru.startandroid.kotlinsqlite.Model.Person
class DBHelper {
fun doSomething() {
val person = Person()
val alternatePerson = Person(123, "Hodor", "Hodor@westeros.com")
person.email
alternatePerson.id
val betterPerson = BetterPerson()
val alternateBetterPerson = BetterPerson(123, "Hodor", "Hodor@westeros.com")
betterPerson.email
alternateBetterPerson.id
}
}
А чё за прикол с email и Id?
okay, after update studio 🙃
слава богам, что ты добавил убрал или в чем была моя ошибка?
Обсуждают сегодня