product
-
[Kotlin] Ex(Product, Repairable)Kotlin 2022. 9. 14. 16:26
Product // Product.kt fun main(){ val tv = Tv() val computer = Computer() val audio = Audio() val buyer = Buyer() buyer.buy(tv) buyer.buy(computer) buyer.buy(audio) buyer.summary() buyer.refund(audio) buyer.summary() } // Product 클래스는 부모클래스 // 멤버변수 prince, bonusPoint를 대표생성자로 생성 // 보조생성자는 price 값만 전달하는 함수로 제작 open class Product constructor(val price:Int, val bousPoint:Int){ constructor( p:Int ):t..