Skip to content

Instantly share code, notes, and snippets.

@send2moran
Created July 9, 2014 19:18
Show Gist options
  • Save send2moran/d95f91cc4213817d4442 to your computer and use it in GitHub Desktop.
Save send2moran/d95f91cc4213817d4442 to your computer and use it in GitHub Desktop.
JS OOP Layer 4 , super const and sub const
function Person(name){
this.name = name;
}
Person.prototype.say = function(){
console.log("hi");
}
function CTO(){
Person.call(this,"dd")
}
CTO.protortype = Object.create(Person.prototype);
CTO.prototype.say = function(){
Person.prototype.say.call(this);
console.log("CTO !")
}
var m = new CTO();
m.say();
console.log(m.name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment