node.js使用util实现简单继承

/**
 * Created by zzq on 2015/5/15.
 */
    var util = require('util');

    var Person = function(){
        var myD='1';
        this.name = "a",
        this.age = "18",
        this.adress = "地球"
    }

    var Student = function(){
        //获取父类的所有成员
        Person.call(this);
        this.No = "学号";
    }

    util.inherits(Student,Person);

var newStu = new Student();
console.log(newStu.name);
原文地址:https://www.cnblogs.com/zzq-include/p/4505750.html