Sealed class in Kotlin
To constrain a class hierarchy, we have to declare the superclass sealed. Without the constraint, our code will look like this:
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 ...
Both composition and inheritance place sub objects inside the new class. With composition, the sub object is explicit whereas the sub object with inheritance...
One of most compelling arguments for object oriented programming is code reuse.
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.
One of the Object Oriented Programming concept is the ability of polymorphism. The word, polymorphism is an ancient Greek term. It means many forms. In progr...
What is upcasting?