Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADJUST

#use v5.44;
use v5.38;
use feature 'class';
no warnings 'experimental::class';

class Point {
    field $x :param;
    field $y :param;

    ADJUST {
        $y = 23;
        #$y += 23;
    }

    method stringify {
        return "($x, $y)";
    }

}

my $p = Point->new(x => 2, y => 19);
say $p->stringify;

ADJUST is called after the instance was created and the attributes were populated.