解决方案 »

  1.   

    Child.prototype.age = 0;
    Child.prototype = new Parent();这两句反过来就好了,因为后面那句直接把已经写好的原型覆盖了
      

  2.   

    Child.prototype = new Parent();
    //先设置继承
    Child.prototype.age = 0;
    //再定义Child类的原型对象的属性age
      

  3.   

    //定义了Child类的原型对象Child Prototype 的一个属性age
    Child.prototype.age = 0;//Child类继承了Parent类(包括Parent类的构造函数中的实例属性和实例方法,以及原型对象中的原型属性和方法)
    Child.prototype = new Parent();
    Child.prototype 现在是什么呢?
      

  4.   

    谢谢楼上的几位指导~~Child.prototype = new Parent(),已经将Parent类的原型对象赋给了Child类的原型对象,把原来Child类的原型对象中定义的原型属性覆盖了,又因为Parent类的原型对象没有对age这个原型属性的定义,所以才会输出undefined。不知道我的理解正不正确??