Inner class
Inner class is like nested class, but an object of inner class maintains a reference to the outer class. inner has implicit link to outer class.
87 posts · page 5 of 11
Inner class is like nested class, but an object of inner class maintains a reference to the outer class. inner has implicit link to outer class.
The object keyword in Kotlin defines something like class. But you cannot create instance of an object, as there is only one. Remember [Singleton pattern][singleton].
A nested class enables us to group more logically, hence it makes it more readable and refined structure. A nested class is simply a class within the namespace of outer class.
To constrain a class hierarchy, we have to declare the superclass sealed. Without the constraint, our code will look like this:
Downcasting is to discover the specific type of a previously upcast object. Upcast is always safe because the base class cannot have a bigger interface than the derived class. Every base class member…
Recent statistics from many [sources][hybrid-work-study] are indicating that a majority of employees desire (and also expect) some kind of remote/hybrid work arrangement after the post-covid era.
Both composition and inheritance place sub objects inside the new class. With composition, the sub object is explicit whereas the sub object with inheritance is implicit.
We touched a bit on Inheritance concept. Inheritance is sometimes used to add functions to a class as a way of reuse for a new purpose.