Instruction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Introducing Inheritance

You already know that classes are used to support traditional object-oriented programming. Class concepts include inheritance, overriding, polymorphism and composition, which makes them suited for this purpose. Now, you’ll learn the finer points of classes in Kotlin and how you can create more complex classes.

Polymorphism

Have you ever noticed how a chameleon can adapt its appearance to blend into its surroundings? Polymorphism in Kotlin is like a chameleon for your code! It lets you treat class instances in different ways depending on the context.

Super

In Kotlin, when you override a method in a subclass, you can leverage the super keyword to interact with the superclass’s version of the method. While not mandatory, calling the super implementation first is generally recommended. This ensures two key benefits:

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo