1

I have just started to learn inheritance, and i have only just begun doingthe basics. Now i wanted to create a "child" constructor of cylon, that inherits all Cylon's properties. But the way i did it seems to be called a bad way. why is this so?

function Cylon(model){
  this.attack = function(){return "Destroy all humans!"};
}

function HumanSkin(model){
}
HumanSkin.prototype =  new Cylon();
HumanSkin.prototype.infiltrate = function(){return "Infiltrate the colonies"};
nova_n
  • 23
  • 7

0 Answers0