-
-
Save Ovid/a935ab3b93300d75d501 to your computer and use it in GitHub Desktop.
String Overloading in Perl 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Point { | |
has $.x = 0; | |
has $.y = 0; | |
method Str { | |
say "[{$.x},{$.y}]"; | |
} | |
} | |
my $point = Point.new; | |
say $point; | |
# Point.new(x => 0, y => 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment