diff --git a/README.md b/README.md index 3b8fb70..85a76be 100755 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ Create a basic constructor... ```javascript // NOTE: new is optional here... -var A = new object.Constructor('A') +var A = new object.Constructor('A', {}) var B = object.Constructor('B', A, {}) @@ -183,6 +183,12 @@ c instanceof B // -> true c instanceof A // -> true ``` +**Note:** +- in `object.Constructor('X', A)` the second argument is used as the + _prototype_, to use `A` as a parent constructor add an empty object + as a third argument, i.e. 'object.Constructor('X', A, {})' + (see: [`Constructor(..)` / `C(..)`](#constructor--c) for more info) + ### Inheritance ```javascript @@ -626,6 +632,15 @@ The resulting _constructor_ function when called will: - call instance's `.__init__(..)` if present. +Note that `Constructor(, )` is intentionally set as default +instead of having the _parent-constructor_ as the last argument, this is +done for two reasons: +- The main cause to inherit from a constructor is to extend it, +- In real code the `Constructor(, )` is more common than + empty inheritance. + + + Shorthand to `Constructor(..)` ``` C(, ..)