Skip to content

Commit 1827324

Browse files
committed
doc the also declarator
1 parent 6e0a5b8 commit 1827324

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Language/classtut.pod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,22 @@ the design wouldn't be better realized by using roles, which are generally
574574
safer because they force the class author to explicitly resolve conflicting
575575
method names. For more information on roles see L<Roles|/language/objects#Roles>.
576576
577+
=head2 The C<also> declarator
578+
579+
Classes to be inherited from can be listed in the class declaration body by
580+
prefixing the C<is> trait with C<also>. This also works for the role
581+
composition trait C<does>.
582+
583+
class GeekCook {
584+
also is Programmer;
585+
also is Cook;
586+
# ...
587+
}
588+
589+
role A {};
590+
role B {};
591+
class C { also does A; also does B }
592+
577593
=head1 Introspection
578594
579595
Introspection is the process of gathering information about some objects in

0 commit comments

Comments
 (0)