A superclass is the class a subclass extends to inherit members and behavior. In Kotlin, inheritance is deliberately opt-in: classes and members are final by default, so a class must be marked `open` before other classes can derive from it. Mark only the members intended for customization as `open`; this limits the fragile base class problem, where superclass changes break subclass assumptions. section 4.1.2
open class User(val nickname: String) { /* ... */ }
class SocialUser(nickname: String) : User(nickname) { /* ... */ }
Place the superclass after `:`. When its primary constructor needs arguments, invoke it in the subclass header with those arguments. section 4.2.1
A superclass constructor must be initialized. Even a superclass with no constructor parameters needs `()` when inherited: `class RadioButton : Button()`. Interfaces differ: they have no constructors, so their names appear in the supertype list without parentheses. section 4.2.1
When a subclass uses secondary constructors, every construction path must eventually initialize the superclass:
- Call the matching superclass constructor with `super(arguments)` when that constructor directly supplies the base-class state. section 4.2.2
- Delegate to another constructor in the same class with `this(arguments)` when it can prepare or convert arguments; that delegated constructor must ultimately call `super(...)`. section 4.2.2
- Use secondary constructors chiefly for Java interoperability or genuinely different creation parameter lists. section 4.2.2
Control what a subclass may change
`RichButton` can expose an overridable `animate()` while keeping `disable()` non-overridable. A `ThemedButton` may override the allowed behavior, and an overridden member remains open unless it is explicitly marked `final`. Abstract classes can also require subclasses to provide abstract properties or functions. section 4.1.2
Superclass is related to, but not identical with, supertype. A subtype can be used wherever its supertype is required. In simple class inheritance, a subclass gives a subtype, but implemented interfaces and nullable types also create subtype relations without describing a different superclass. section 11.3.2









