Perl6 Object Oriented Cookbook (v0.2.1)  
Section 1: Introduction to Object Oriented Perl6  
 
Recipe 1.3: Inheriting from Another Class
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 your new class to inherit the behaviors of an already existing class.

Solution:  

Use the is keyword after the class name:

class DerivedClass is MyClass;

Discussion:

Internally, properties and parent classes are implemented in roughly the same manner: parent classes can in fact be thought of as properties, and vice versa. The same keyword is used for both concepts.


Log In to Comment


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