develooper Front page | perl.perl6.language | Postings from June 2005

OO magic (at least for me)

Thread Next
From:
=?ISO-8859-2?Q?B=C1RTH=C1ZI_Andr=E1s?=
Date:
June 26, 2005 04:55
Subject:
OO magic (at least for me)
Message ID:
42BE9797.3050407@barthazi.hu
Hi,

I'm wondering, if it's possible with Perl 6 or not?

class MyClass {

	method mymethod($par) {
		say "mymethod called!";
	}

}

class ExClass is MyClass {

	mymethod(12);

}

#> pugs myprog
mymethod called!

I would like to use mymethod to add ExClass some methods, etc.

///

Just another problem, related to the above:

class MyClass {

	method whenmother() {
		say "MyClass is parent now!!!";
		say "Her child name is: " ~ ????;
	}

}

class Child is MyClass {
}

#> pugs myprog
MyClass is parent now!!!
Her child name is: Child

Bye,
   Andras

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About