MENU

Fun & Interesting

Three Simple Rules for Subtypes

Dave Leeds 3,409 1 year ago
Video Not Working? Fix It Now

Inheritance, declaration-site variance, and type projections are all based on three simple rules for subtypes. Once you understand those three rules, you can reason your way through inheritance and generic variance. In this video, we'll learn what those three rules are, and then see how they apply to a variety of Kotlin language features! ✨ New to Kotlin? Start your journey here: https://typealias.com/start/ ... or pick up the new Leanpub Edition for offline access and more! https://book.typealias.com/ 🚀 Get the inside scoop on everything I'm working on - join my brand new email newsletter! Sign up here: https://newsletter.typealias.com/ 📘 For further study: "Fundamentals of Object-Oriented Design in UML" by Meilir Page-Jones, published in 2000 by Dorset House Publishing and Addison-Wesley. 📚 Kotlin: An Illustrated Guide - Chapter 19: Generic Variance Read the chapter online here: https://typealias.com/start/kotlin-variance/ 00:00 Introduction and Example Models 01:05 Three Simple Rules 02:42 Applied to Class Inheritance 04:08 Applied to Declaration-Site Variance 07:21 Applied to Use-Site Variance 12:36 Wrapping Up

Comment