Perl6 Object Oriented Cookbook (v0.2.1)  
Section 1: Introduction to Object Oriented Perl6  
 
Recipe 1.12: Cloning an Object
Last Updated: Sep 8, 2003
Status: Draft
      Previous Page   Next Page

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

How acceptable is the proposed solution?
  (Login to Vote)
4.00 Rating, 3 Votes  

Problem:  

You want to make a cloned copy of an existing object.

Solution:  

Use the CLONE method, made available to every perl6 object:

print $obj.CLONE;

Issue: Deep vs. shallow cloning.


Log In to Comment


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