parrotcode: testing object oriented features | |
Contents | Language Implementations | Pipp |
t/php/oo.t - testing object oriented features
perl t/harness t/php/oo.t
Defining and using objects.
class Foo {
has $.member is rw; # default value for members is not implemented yet in Rakudo method set_member() { $.member = 'a member of Foo'; } method echo_member() { print $.member; print "\n"; } }
my Foo $foo .= new(); $foo.set_member(); $foo.echo_member();
class Foo { method one_arg($arg_1) { print $arg_1; print "\n"; } }
my $foo = Foo.new(); $foo.one_arg('the first argument');
|