Course of Raku / Objects, I/O, and exceptions / Classes and objects / Classes / Exercises

Name the type

Problem

Define two empty classes, Cat and Dog, and make a Cat instance called $felix. Print the type of $felix with WHAT. Then, on two more lines, print whether that type is the same as Cat, and whether it is the same as Dog, using the === operator.

Example

The program prints:

(Cat)
True
False

Solution

See the solution

Course navigation

Solution: Defined or not   |   Solution: Name the type