Created
July 9, 2014 19:18
-
-
Save send2moran/d95f91cc4213817d4442 to your computer and use it in GitHub Desktop.
JS OOP Layer 4 , super const and sub const
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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