728x90 익명 중첩 클래스1 코틀린 익명 중첩 클래스 package innerclass // inner에서는 outer 접근 자유롭다 // outer에서는 inner 접근 어려움 fun main() { val obj1 = Outer1() val obj2 = obj1.Inner() obj2.innerMethod2() val t1 = TestClass2() t1.testMehtod1() val t3 = object :TestClass1(){ override fun testMehtod1() { println("익명 중첩 클래스의 testMehod1") } } t3.testMehtod1() // 인터페이스는 생성자 없음 val t4 = object :TestInter1{ override fun interMethod1() { println("익명 중첩 클래스의 in.. 2022. 5. 25. 이전 1 다음 728x90