Please enable JavaScript.
Coggle requires JavaScript to display documents.
PROTOTYPICAL INHERITANCE - Coggle Diagram
PROTOTYPICAL
INHERITANCE
CREATING
Circle.prototype
= Object.create(Shape.prototype)
Reset
Constructor
Circle.prototype.constructor
= Circle
INTERMEDIATE
Function
Inheritance
func extend(Child, Parent)
Child.prototype =
Object.create(Parent.prototype)
Child.prototype.constructor
Child
CALLING
Super
function Circle() {...}
Shape.call(this, color)
OVERRIDING
Method
After
Inheriting
Create
Prototype
Method
OnChild
INHERITANCE
Avoid
Hierarchies
Limit
One-Level
Favor
Composition
With-Own
Members
Child.prototype
= new Parent()
Child.prototype.constructor
Child
MIXINS
Abilitiy-Objects
canEat
{ eat: func() }
canWalk
Compose
Object.assign(...)
Person.prototype
canEat, canWalk
mixin(target, ...sources)
Object.assign(...)
target
...sources