Hi All,
Now what am I doing wrong?
-T
class Angle {
# has num64 $.degrees;
method AngleCosine( Rat:D: --> Rat:D ) {
my Numeric $radians = self*π/180;
print "self = <" ~ self ~ "\n";
print "radians = <$radians>\n";
return $radians.cos;
}
}
say (45.0).AngleCosine
No such method 'AngleCosine' for invocant of type 'Rat'
in block <unit> at <unknown file> line 1
I can't get this to work either:
class String2 {
method PrintStr( Str:D: ) {
print "self = <" ~ self ~ ">\n";
}
}
say "abc".PrintStr
No such method 'PrintStr' for invocant of type 'Str'
in block <unit> at <unknown file> line 2