Perl6 Object Oriented Cookbook (v0.2.1)  
Section 1: Introduction to Object Oriented Perl6  
 
Recipe 1.5: Declaring Methods
Last Updated: Sep 8, 2003
Status: Very Likely
      Previous Page   Next Page

How important is this problem to you?
  (Login to Vote)
5.00 Rating, 5 Votes  

How acceptable is the proposed solution?
  (Login to Vote)
5.00 Rating, 5 Votes  

Problem:  

You want to declare a method of a class.

Solution:  

Use the method keyword:

class MyClass {
    method do_something {
        ...
    }
}
See later recipes for declaring methods with specific signatures.


Log In to Comment


Login / Edit User Info -- Copyright © 2002 Cognitivity -- Previous Page   Next Page