method parents

Documentation for method parents, assembled from the following types:

role Metamodel::MultipleInheritance

From Metamodel::MultipleInheritance

(Metamodel::MultipleInheritance) method parents

method parents(Metamodel::MultipleInheritance:D: $obj:$all:$tree)

Returns the list of parent classes. By default it stops at Cool, Any or Mu, which you can suppress by supplying the :all adverb. With :tree, a nested list is returned.

class D { };
class C1 is D { };
class C2 is D { };
class B is C1 is C2 { };
class A is B { };
 
say A.^parents(:all).perl;
# OUTPUT: «(B, C1, C2, D, Any, Mu)␤» 
say A.^parents(:all:tree).perl;
# OUTPUT: «[B, ([C1, [D, [Any, [Mu]]]], [C2, [D, [Any, [Mu]]]])]␤»