``` interface Currency {} enum class JPY : Curren...
# announcements
k
Copy code
interface Currency {}

enum class JPY : Currency 
enum class THB : Currency

data class Money<C : Currency>(val amount: Double)

fun convertJPYToTHB(jpy: Money<JPY>): Money<THB> {
    val exchangeRate = 0.34
    return Money(amount = jpy.amount * exchangeRate)
}   
    
val moneyInBaht = convertJPYToTHB(Money<JPY>(10000.0)) //compile
val moneyInYen =  convertJPYToTHB(Money<THB>(10000.0)) //not compile
println(moneyInBaht)
­čś» 1