Nested & Inner Classes
Last updated
What is Nested & Inner Classes?
Kotlin allows you to define classes inside other classes. A nested class is declared inside another class but doesn't have access to the outer class's instance. An inner class, on the other hand, is declared with the inner keyword and does have access to the outer class's instance members. This provides a way to logically group classes and control access to data.
Free resources to learn Nested & Inner Classes
- Official docsNested and inner classes
- ArticleUnderstanding Nested and Inner Classes in Kotlin
- VideoKotlin Nested Classes
- VideoKotlin Inner Classes
More in stage 23: Class Members
Nested & Inner Classes: common questions
Can I learn Nested & Inner Classes in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Nested & Inner Classes in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Nested & Inner Classes tutorial for beginners?
It is lesson 73 of 153 in the free Kotlin roadmap, in stage 23, Class Members. If you are new to Kotlin, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.