The first solution I found is having an `object` t...
# multiplatform
g
The first solution I found is having an
object
that delegates to a header class:
Copy code
object Math{
    private val delegate = MathDelegate()
    val PI:Double = delegate.pi()
    fun abs(d: Double): Double      = delegate.abs(d)
    fun acos(d: Double): Double     = delegate.acos(d)
    fun asin(d: Double): Double     = delegate.asin(d)
    fun cos(d: Double): Double      = delegate.cos(d)
    fun sin(d: Double): Double      = delegate.sin(d)
    fun tan(d: Double): Double      = delegate.tan(d)
    fun sqrt(d: Double): Double     = delegate.sqrt(d)
}


header class MathDelegate {
    fun pi():Double
    fun abs(d: Double):Double
    fun acos(d: Double):Double
    fun asin(d: Double):Double
    fun cos(d: Double):Double
    fun sin(d: Double):Double
    fun sqrt(d: Double):Double
    fun tan(d: Double):Double
}