Free AI web copilot to create summaries, insights and extended knowledge, download it at here
2069
Abstract
url=https%3A%2F%2Fpl.kotl.in%2FVG_7yTWo5&image=https%3A%2F%2Fplay.kotlinlang.org%2Fassets%2Fog-image.png&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=kotl" allowfullscreen="" frameborder="0" height="300" width="800">
</div>
</div>
</figure></iframe></div></div></figure><p id="af9e">A method marked <code>override</code> is automatically <code>open</code>. To prohibit that, use <code>final override</code> instead.</p><h1 id="585c">Properties</h1><p id="0b6b">As with classes and methods, properties which can be overridden must be marked as <code>open</code> and overriding properties with <code>override</code>. Keep in mind that properties are actually (one or two) functions, so there are various ways you can override them.</p>
<figure id="b5b7">
<div>
<div>
<img class="ratio" src="http://placehold.it/16x9">
<iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fpl.kotl.in%2FzXKwv9h-I&display_name=Kotlin+Playground&url=https%3A%2F%2Fpl.kotl.in%2FzXKwv9h-I&image=https%3A%2F%2Fplay.kotlinlang.org%2Fassets%2Fog-image.png&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=kotl" allowfullscreen="" frameborder="0" height="300" width="800">
</div>
</div>
</figure></iframe></div></div></figure><p id="819a">You can also override a <code>val</code> property with a <code>var</code> property, but not vice versa. This is allowed because a <code>val</code> property essentially declares a get method, and overriding it as a <code>var</code> additionally declares a set method in the derived class.</p><h1 id="61b6">Calling the superclass implementation</h1><p id="8454">…can be done using <code>super</code>:</p>
<figure id="98ab">
<div>
<div>
<img class="ratio" src="http://placehold.it/16x9">
<iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3
Options
A%2F%2Fpl.kotl.in%2FI9F4uITgD&display_name=Kotlin+Playground&url=https%3A%2F%2Fpl.kotl.in%2FI9F4uITgD&image=https%3A%2F%2Fplay.kotlinlang.org%2Fassets%2Fog-image.png&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=kotl" allowfullscreen="" frameborder="0" height="300" width="800">
</div>
</div>
</figure></iframe></div></div></figure><h1 id="0b58">Multiple inheritance</h1><p id="8789">If a class inherits multiple implementations of the same member from its immediate parents, it must override this member and provide its own implementation (perhaps, using one of the inherited ones). The parent implementations are qualified using <code>super<ParentClass>.parentMethod()</code></p>
<figure id="db8b">
<div>
<div>
<img class="ratio" src="http://placehold.it/16x9">
<iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fpl.kotl.in%2FYy-fzqLyv&display_name=Kotlin+Playground&url=https%3A%2F%2Fpl.kotl.in%2FYy-fzqLyv&image=https%3A%2F%2Fplay.kotlinlang.org%2Fassets%2Fog-image.png&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=kotl" allowfullscreen="" frameborder="0" height="300" width="800">
</div>
</div>
</figure></iframe></div></div></figure><p id="1eb9">Go back to <a href="https://readmedium.com/inheritance-basics-8d5dc28d326e">Inheritance — basics</a>, jump to the <a href="https://readmedium.com/table-of-contents-c52573cfa291">Table of Contents</a>, or continue to <a href="https://readmedium.com/interfaces-936fe79a6450">Interfaces</a>.</p><figure id="8ecd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*biBSB579iezsNvEQ_NMLBg.png"><figcaption><a href="https://www.etnetera.cz/prace-u-nas?utm_source=medium&utm_medium=GabrielShanahan&utm_campaign=KotlinPrimer&utm_content=join-our-team&utm_term=KotlinPrimer#pozice">Join me in Etnetera</a></figcaption></figure></article></body>