摘要
JavaScript是面向Web的编程语言,其高端、动态以及面向对象的编程风格,使得它已经从一门简单的脚本语言进化成为一门强大的编程语言。JS的核心是支持面向对象的,同时它也提供了强大灵活的面向对象语言的编程能力。本文针对JavaScript继承机制的实现方式进行了总结归纳,深入介绍了基于原型的继承、构造函数方式继承、组合继承、寄生式继承等继承机制,并分析了各自方式的优缺点,便于读者更深层次的理解JavaScript面向对象编程机制。
Javascript is a web-oriented programming language.Its high-end,dynamic and object-oriented programming style has evolved from a simple scripting language to a powerful programming language.The core of JS is to support objectoriented,and it also provides powerful and flexible programming ability of object-oriented language.This paper summarizes the implementation of JavaScript inheritance mechanism,introduces the inheritance mechanism based on prototype,constr uctor,combination and parasitism,and analyzes the advantages and disadvantages of each method,which is convenient for readers to understand the JavaScript object-oriented programming mechanism.
作者
周岚
ZHOU Lan(Xuzhou Finance and Economics Branch,Jiangsu Union Technical Institute,Xuzhou 221008,China)
出处
《软件工程》
2019年第12期14-17,共4页
Software Engineering
关键词
原型链
继承
原型对象
构造函数
prototype chain
inheritance
prototype object
constructor