Constructor with parameters
#use v5.44;
use v5.38;
use feature 'class';
no warnings 'experimental::class';
class Point {
field $x :param;
field $y :param;
}
my $p = Point->new(x => 2, y => 3);
say $p;
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
#use v5.44;
use v5.38;
use feature 'class';
no warnings 'experimental::class';
class Point {
field $x :param;
field $y :param;
}
my $p = Point->new(x => 2, y => 3);
say $p;