The prototype of Prototype design pattern

Source: Internet
Author: User

At this stage, only the application, only the ability to do the application, also only to do the application environment. At this stage, do not engage in research and development, do not have the ability to do research and development, and do not have the opportunity. At this stage, only the real, not innovation.
Public abstract class Abstractspoon implements Cloneable
{
string spoonname;

public void Setspoonname (string spoonname) {this.spoonname = Spoonname;}
public String Getspoonname () {return this.spoonname;}

    

Public Object Clone ()
{
object = null;
    try {
Object = Super.clone ();
    The catch (Clonenotsupportedexception exception) {
System.err.println ("Abstractspoon is not cloneable");

Return object;   
}

 

Public class Soups Tutorial Poon extends Abstractspoon
{
Public soupspoon ()
{
Setspoonname ("Soup spoon");
}
}

Public class Saladspoon extends Abstractspoon
{
Public saladspoon ()
{
Set Spoonname ("Salad spoon");
}
}

The

Prototype.js is a very elegant web page effect base Class library written by Sam Stephenson, which is a great extension of JavaScript and a good support for Ajax, as well as a library of effects based on such libraries at home and abroad.   Prototype.js is not only a great practical value of the JS library, but also has a high learning value.   --in Prototype.js, prototype object is an important mechanism to realize object-oriented. Each function is an object (function) that has a child object prototype object, and the class is defined as a function.   Prototype represents the prototype of the function and also represents a collection of members of a class.   When you create an instance object of a class by using new, the members of the prototype object become members of the instantiated object.   1, the object is referenced by the class, only the function object can be referenced, 2, after the new instantiation, its members are instantiated, the instance object can be called. At the same time, a function is an object in which a function object declares a member directly without being instantiated to call the

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.