本帖最后由 e98123 于 2013-09-08 12:08:49 编辑

解决方案 »

  1.   

    好像不行, 直接把a 设成全局变量  调用时 a.xxx.xxxx
      

  2.   

    在定义子类时  有个属性指定子类的直接父类  
    然后遍历父类的prototype属性试试
      

  3.   


    不行子默认情况下没有父的句柄(为什么默认不能 因为一个子可以有好多父引用它)
    除非你传给他而且  this代表当前域 和父没任何关系(当前域就是d)
    完全理解错误 在去看看书把
      

  4.   

    你想取得b  就直接 a.b 
      

  5.   

    如果用构造方式,直接a.b则不能了呀function a {
        this.b = true;
        this.c = {
            d: function() {
                return this.constructor.prototype.b;
                // 子类或孙类 如何 取父类下的属性或方法?“this.constructor.prototype.b”这样会出错呢
            }
        };
      

  6.   

     this.c = {
        var _this = this;
            d: function() {
                return _this.b;
            }
        };
    基础还不够,先补吧,不要那么着急写什么类啊,继承什么的
      

  7.   

    //在闭包中,要取上层this ,因为this是变化的,解决方法  this 另存在一个变量里
    function a {
        this.b = true; 
        var me=this;
        this.c = {
            d: function() {
                return me.b;
                // 子类或孙类 如何 取父类下的属性或方法?“this.constructor.prototype.b”这样会出错呢
            }
        };