Recommended sites

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits
Prototype Print E-mail
User Rating: / 1
PoorBest 
Thursday, 20 January 2005 21:43
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.



Source Code

/**
 * Declares interface for cloning itself.
 * @role __Prototype
 */
public interface Prototype {
        Prototype createCopy();}

/**
 * Implements an operation for cloning itself.
 */
public class ConcretePrototype1 implements Prototype {
        protected ConcretePrototype1(ConcretePrototype1 prototype) 
        {
           // initialize new copy with prototype
        }

        public Prototype createCopy() {
           return new ConcretePrototype1(this);        
        }
}

/**
 * Implements an operation for cloning itself.
 */
public class ConcretePrototype1 implements Prototype {
        protected ConcretePrototype1(ConcretePrototype1 prototype) {
          // initialize new copy with prototype
        }

        public Prototype createCopy() {
                return new ConcretePrototype1(this);        
        }
}
Comments
Add New Search RSS
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:):grin;)8):p:roll:eek:upset:zzz:sigh:?:cry
:(:x
Please input the anti-spam code that you can read in the image.

3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Saturday, 18 June 2005 00:02 )
 


Another articles:


Content View Hits : 2418445

Enter Amount: