The next feature of object-oriented programming is inheritance. In this section, we talk about inheritance and related topics in Perl 6.
Inheritance
Inheriting from a class
Inheriting in OOP means creating a new class, which extends another already existing class. The simplest form of inheritance is a child-parent pair of two classes.
In the previous sections, we created the House class. Let us use it as the parent class for another concept. We will create a ModernHouse class, which is a House with a solar roof panel. A bare House, which we created earlier in this chapter, contains four attributes—number of rooms, area, height, and address. The address attribute was an Address object in our previous examples but, in...