• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
向阳光大道勇猛前进吧,了解但不走偏门!
            管理     

super

1.super指向基类原型prototype                   范围:普通方法

class smile {
			constructor() {
				
				
			}
			boy() {
				alert('hey');
			}
		}
		class sun extends smile {
		
			aa() {
				super.boy();
			}
		}
		var bb = new sun();
		bb.aa();                 //hey

  

2.super指向基类构造函数constructor

	class A {
			 constructor() {
			 	alert(this);       //返回实例对象B
            }
        }
    class B extends A {
    	constructor() {
    		super();
        }
    }
  new B();           //B

  

圣凡无二路,方便有多门。
posted @ 2018-07-19 13:20  优昙陀罗  阅读(162)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3