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

Quiz — Class methods

What does the following program print? The method n uses no attributes.

class T {
    method n { 42 }
}

say T.n + T.new.n;
042
184
0(T)
0an error

Course navigation

Solution: Kilometres to miles   |   Subroutines vs methods