Perl6 Object Oriented Cookbook (v0.2.1)  
Section 1: Introduction to Object Oriented Perl6  
 
Recipe 1.2: Assigning Class Properties
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, 6 Votes  

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

Problem:  

You want to assign properties to a class definition.

Solution:  

Use the is keyword after the class name:

class MyClass is prop1 is prop2;

Discussion:

The is keyword associates one or more properties with the given class.

By convention, property names should begin with a lowercase letter.


Log In to Comment


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