@ -8,14 +8,17 @@ In order to understand how `prototypal inheritance` works you will have to recre
You will have `Animal` which will an object and will have the following properties:
- `canEat`, `canBreath`, `isAlive`: All booleans, set to true.
- `name`: set to `"Anonymous"`.
- `WhoAmI`: Function that returns a string, here it will be `"I'm an animal"`.
- `NameToUppercase`: Function that returns `name` to uppercase.
The following objects will inherit from `Animal` and add/override fields as follow:
- `Dog`: adds property `canRun` set to `true`.
- `Bird`: adds properties `canFly` and `makesEggs` set to `true`.
- `Dodo`: overrides `canFly` and `isAlive` to `false`.
- `Dodo`: inherits from `Bird` and overrides `canFly` and `isAlive` to `false`.
All of them will override `WhoAmI`, returning `"I'm a [animal name]"`.
- All of them will override `WhoAmI`, returning `"I'm a [animal name]"`.
- All can accept a specific `name` as argument when created or use the default in `Animal` if no argument is provided.
> There are many different ways to work on prototypes, we suggest to use `Object.assign` and similar functions, but feel free to experiment other ways to understand the differences.
@ -27,8 +30,8 @@ Here is a possible program to test your function:
// Your implementation of Animal, Dog, Bird and Dodo ...