Jump to content

Raku Programming/Roles and Inheritance

From Wikibooks, open books for an open world

Inheritance

[edit | edit source]

Basic class systems enable data and the code routines that operate on that data to be bundled together in a logical way. However, there are more advanced features of most class systems that enable inheritance too, which allows classes to build upon one another. Inheritance is the ability for classes to form logical hierarchies. Raku supports normal inheritance of classes and subclasses, but also supports special advanced features called mixins, and roles. We are going to have to reserve some of the more difficult of these features for later chapters, but we will introduce them here.

Class Inheritance

[edit | edit source]

Roles and does

[edit | edit source]

Mixins

[edit | edit source]

Parametric Roles

[edit | edit source]