继承的4种基本方式

1、构造继承
        function Parent(){
            this.name = "Parent";
        }
        function Child(){
            Parent.call(this);
        }
        var child = new Child();
        console.log(child.name);   
2、原型继承
        function Parent(){
            this.name = "Parent";
        }
        function Child(){
        }
        Child.prototype = new Parent();
        var child = new Child();
        console.log(child.name);
3、实例继承
function ArrayCollection(){
    return [];
}

var ac = new ArrayCollection();

比较奇特的继承,跟直接执行函数一样,得到的是返回值。


4、拷贝继承
拷贝继承,满大街都是,分深层拷贝和浅层拷贝两种。
原文地址:https://www.cnblogs.com/geilishu/p/5232695.html