# Reference nested class-constructor

**URL:** <https://discuss.kotlinlang.org/t/reference-nested-class-constructor/16224>\
**Category:** Support\
**Created:** [February 5, 2020, 3:53pm UTC](https://discuss.kotlinlang.org/t/reference-nested-class-constructor/16224 "2020-02-05T15:53:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tieskedh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/tieskedh/32/2816_2.png) [@tieskedh](https://discuss.kotlinlang.org/u/tieskedh)\
**Post date:** [February 5, 2020, 3:53pm UTC](https://discuss.kotlinlang.org/t/reference-nested-class-constructor/16224/1 "2020-02-05T15:53:16Z")

</div>

What is the way to reference a nested classes constructor-param:

```
class SomeClass {
    class State(val value: String)
}

class OtherClass{
    class State(val value: String)
}

fun t() {
    //doesn't work
    "".let(::SomeClass.State) 
    "".let(::OtherClass.State)
}

```

importing State from both of the classes under a different alias and calling without the outerclasses does work, but I was hoping there is a way to do this while the outerclass in the reference…

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [February 5, 2020, 4:03pm UTC](https://discuss.kotlinlang.org/t/reference-nested-class-constructor/16224/2 "2020-02-05T16:03:01Z")

</div>

I think what you are looking for is `SomeClass::State`, but this would still fail in your example

```kotlin
"".let(SomeClass::State)

```

> Type mismatch: inferred type is KFunction0\<SomeClass.State\> expected (String) → ???

---

<div class="post-metadata">

**Author:** ![tieskedh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/tieskedh/32/2816_2.png) [@tieskedh](https://discuss.kotlinlang.org/u/tieskedh)\
**Post date:** [February 5, 2020, 4:06pm UTC](https://discuss.kotlinlang.org/t/reference-nested-class-constructor/16224/3 "2020-02-05T16:06:47Z")

</div>

Thx!  
I knew you could access functions on the class that way.  
I didn’t know Kotlin would also make it refer to the constructor of the nested class.  
Updated the answer to make the example work.

Thx again!
