Chapter 5 - Section 5
fun main(args: Array<String>) {
val item = ClothingItem("Shirt", "L", 19.99)
println(item)
item.price = 15.99
println(item)
val item2 = ClothingItem("M", 14.99)
println(item2)
}
data class ClothingItem (var type: String?,
val size: String,
var price: Double) {
init {
type = type?.toUpperCase() ?: "UNKNOWN"
}
constructor(size: String, price: Double) : this(null, size, price){
// type = "Unknown"
}
}