txt: ## multipleinheritance.md
  role Metamodel::MultipleInheritance
  
  Metaobject that supports multiple inheritance
  
  ```raku
  role Metamodel::MultipleInheritance {}
  ```
  
  *Warning*: this role is part of the Rakudo implementation, and is not a part of the language specification.
  
  Classes, roles and grammars can have parent classes, that is, classes to which method lookups fall back to, and to whose type the child class conforms to.
  
  This role implements the capability of having zero, one or more parent (or *super*) classes.
  
  In addition, it supports the notion of *hidden* classes, whose methods are excluded from the normal dispatching chain, so that for example `nextsame` ignores it.
  
  This can come in two flavors: methods from a class marked as `is hidden` are generally excluded from dispatching chains, and `class A hides B` adds `B` as a parent class to `A`, but hides it from the method resolution order, so that [mro\_unhidden](/type/Metamodel/C3MRO#method_mro_unhidden) skips it.
  
  # [Methods](#role_Metamodel::MultipleInheritance "go to top of document")[§](#Methods "direct link")
  
  ## [method add\_parent](#role_Metamodel::MultipleInheritance "go to top of document")[§](#method_add_parent "direct link")
  
  ```raku
  method add_parent($obj, $parent, :$hides)
  ```
  
  Adds `$parent` as a parent type. If `$hides` is set to a true value, the parent type is added as a hidden parent.
  
  `$parent` must be a fully [composed](/language/mop#Composition_time_and_static_reasoning) typed. Otherwise an exception of type [`X::Inheritance::NotComposed`](/type/X/Inheritance/NotComposed) is thrown.
  
  ## [method ^parents](#role_Metamodel::MultipleInheritance "go to top of document")[§](#method_^parents "direct link")
  
  ```raku
  method ^parents($obj, :$all, :$tree)
  ```
  
  Returns the list of parent classes. By default it stops at [`Cool`](/type/Cool), [`Any`](/type/Any) or [`Mu`](/type/Mu), which you can suppress by supplying the `:all` adverb. With `:tree`, a nested list is returned.
  
  ```raku
  class D { };
  class C1 is D { };
  class C2 is D { };
  class B is C1 is C2 { };
  class A is B { };
  
  say A.^parents(:all).raku;
  # OUTPUT: «(B, C1, C2, D, Any, Mu)␤»
  say A.^parents(:all, :tree).raku;
  # OUTPUT: «[B, ([C1, [D, [Any, [Mu]]]], [C2, [D, [Any, [Mu]]]])]␤»
  ```
  
  ## [method hides](#role_Metamodel::MultipleInheritance "go to top of document")[§](#method_hides "direct link")
  
  ```raku
  method hides($obj)
  ```
  
  Returns a list of all hidden parent classes.
  
  ## [method hidden](#role_Metamodel::MultipleInheritance "go to top of document")[§](#method_hidden "direct link")
  
  ```raku
  method hidden($obj)
  ```
  
  Returns a true value if (and only if) the class is marked with the trait `is hidden`.
  
  ## [method set\_hidden](#role_Metamodel::MultipleInheritance "go to top of document")[§](#method_set_hidden "direct link")
  
  ```raku
  method set_hidden($obj)
  ```
  
  Marks the type as hidden.
  