Differences and relationships between prototype-Oriented Programming and prototype Pattern

Source: Internet
Author: User

Good description from "dead of winter"

The prototype-oriented language idea is exactly the same as the prototype mode: The objects cloned from the same prototype are a class of objects. The prototype-oriented language provides language-level support for this mode, that is, all the definitions of "classes" are implemented by specifying a prototype of the class (class-based programming describes a class object through class structure Declaration, meta-class describes a class object by constructing a class object ). The prototype is cloned once for each instance. However, this method causes information redundancy: all objects hold a clone copy of the prototype object, and once an object is constructed, modifying a prototype does not affect it, which may affectProgramIt is inconvenient for people who change a certain type of objects. Therefore, a work ing method is generated: The reference prototype object, in contrast to the original prototype object usage method is called
Copy the prototype object. The reference prototype object does not clone the prototype, but saves a pointer to the prototype. when accessing the property, first check its own property. When it finds that the property does not exist, then, the pointer is used to obtain the corresponding property from the prototype. The reference prototype is the implementation of JavaScript prototype-oriented features.

Http://blog.csdn.net/dead_of_winter/article/details/1902063

Prototype Oriented http://blog.csdn.net/dead_of_winter/article/details/1646024

Javascript inheritance http://blog.csdn.net/dead_of_winter/article/details/1626003

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.