Class Inheritance: What is it?

<p>A component of object-oriented programming, inheritance happens when a new object takes on properties of objects that already exist.</p> <p>What&rsquo;s the benefit of this?</p> <p>Consider when creating items for an RPG. You will have many items:</p> <p>Crates, pots, weapons, consumables, amulets, gems, spells, coin and so on.</p> <p>We could start with a custom class named Item. Each item will have a name, item id, and icon.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:239/1*TVmd7WeIAJ2d97KX7-RtMQ.png" style="height:192px; width:217px" /></p> <p>Now, let&rsquo;s create another custom class named Weapons and allow it to inherit from the Item class.</p> <p><a href="https://medium.com/@alexandrmayor/class-inheritance-what-is-it-c1ba4d75ee55"><strong>Learn More</strong></a></p>