fun main(args: Array<String>) {
val pessoa = Person("João", "Silva")
pessoa.age = 47
println(pessoa.fullName)
println(pessoa.Firula())
println(pessoa.firula)
val pessoa2 = pessoa.copy()
println(pessoa2.age)
pessoa2.age = 40
println(pessoa2.age)
println(pessoa == pessoa2)
println(pessoa2)
}
data class Person(val firstName: String, val lastName: String) {
fun Firula(): String = "O nome dele é " + firstName + " " + lastName
val firula: String
get() = "O nome dele é " + firstName + " " + lastName
var age: Int = 0
override fun toString() = firstName + " " + lastName
}
val Person.fullName: String
get() = firstName + " " + lastName
//https://pt.stackoverflow.com/q/228429/101
ZnVuIG1haW4oYXJnczogQXJyYXk8U3RyaW5nPikgewogICAgdmFsIHBlc3NvYSA9IFBlcnNvbigiSm/Do28iLCAiU2lsdmEiKQogICAgcGVzc29hLmFnZSA9IDQ3CiAgICBwcmludGxuKHBlc3NvYS5mdWxsTmFtZSkKICAgIHByaW50bG4ocGVzc29hLkZpcnVsYSgpKQogICAgcHJpbnRsbihwZXNzb2EuZmlydWxhKQogICAgdmFsIHBlc3NvYTIgPSBwZXNzb2EuY29weSgpCiAgICBwcmludGxuKHBlc3NvYTIuYWdlKQogICAgcGVzc29hMi5hZ2UgPSA0MAogICAgcHJpbnRsbihwZXNzb2EyLmFnZSkKICAgIHByaW50bG4ocGVzc29hID09IHBlc3NvYTIpCiAgICBwcmludGxuKHBlc3NvYTIpCn0KCmRhdGEgY2xhc3MgUGVyc29uKHZhbCBmaXJzdE5hbWU6IFN0cmluZywgdmFsIGxhc3ROYW1lOiBTdHJpbmcpIHsKICAgIGZ1biBGaXJ1bGEoKTogU3RyaW5nID0gIk8gbm9tZSBkZWxlIMOpICIgKyBmaXJzdE5hbWUgKyAiICIgKyBsYXN0TmFtZQoJdmFsIGZpcnVsYTogU3RyaW5nCgkgICAgZ2V0KCkgPSAiTyBub21lIGRlbGUgw6kgIiArIGZpcnN0TmFtZSArICIgIiArIGxhc3ROYW1lCgl2YXIgYWdlOiBJbnQgPSAwCglvdmVycmlkZSBmdW4gdG9TdHJpbmcoKSA9IGZpcnN0TmFtZSArICIgIiArIGxhc3ROYW1lCn0KCnZhbCBQZXJzb24uZnVsbE5hbWU6IFN0cmluZwogICAgZ2V0KCkgPSBmaXJzdE5hbWUgKyAiICIgKyBsYXN0TmFtZQogICAgCi8vaHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzIyODQyOS8xMDE=