JavaScriptThe good parts for humans
(part 6)
B Anjaneyulu ReddyEmail: [email protected]
Twitter: @_anjiwww.evibe.in
Agenda
Day 5 revisit
Inheritance
Inheritance
Patterns
Pseudoclassical
Prototypal
Functional
Constructor functions
Sample 1
Pseudoclassical
Prototypal
Objects inherits from objects
Differential inheritance
Sample 2
Functional (1 of 2)
Create a function which has 4 stepso It creates new object
- Object literal
- Constructor function with new keyword
- Object.create()
- call a function which returns an object
o It has private (local) instance variables and methodso It augments that new objecto return that new object
Functional (2 of 2)
// pseudocode
var constructor = function(spec) {
var that,
other private instance variables;
that = a new object
Add privileged methods to that
return that;
}
Sample 3
Questions?
Thank You