<kotlin companion object constructor> im studying ...
# stackoverflow
u
kotlin companion object constructor im studying kotlin with design pattern. so i write singleton pattern. below code is test code. first show that instance is only one. second show that there is no public constructor. import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Test class TestSimpleSingleton { @Test fun testCreateSingleton() { val s = Singleton.Instance() val s2 = Singleton.Instance() assertSame(s, s2)...