如何实现C类?

var A = function(name){

  this.name=name;

}


A.prototype = {

  sayName:function(){

    alert(this.name);

  }

}


var B = function(age){

  this.age = age;

}

B.prototype = {

  sayAge : function(){

    alert(this.age)

  } 

}




//function C(){};



var c = new C("white",25);


c.sayName();

c.sayAge();


素胚勾勒不出你
浏览 492回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript