syntax is

Documentation for syntax is assembled from the following types:

language documentation Type system

From Type system

(Type system) classes is is

Defined as:

multi sub trait_mod:<is>(Mu:U $childMu:U $parent)

The trait is accepts a type object to be added as a parent class of a class in its definition. To allow multiple inheritance the trait can be applied more than once. Adding parents to a class will import their methods into the target class. If the same method name occurs in multiple parents, the first added parent will win.

If no is trait is provided the default of Any will be used as a parent class. This forces all Perl 6 objects to have the same set of basic methods to provide an interface for introspection and coercion to basic types.

class A {
    multi method from-a(){ 'A::from-a' }
}
say A.new.^parents(:all).perl;
# OUTPUT: «(Any, Mu)␤» 
 
class B {
    method from-b(){ 'B::from-b ' }
    multi method from-a(){ 'B::from-A' }
}
 
class C is A is B {}
say C.new.from-a();
# OUTPUT: «A::from-a␤»