en.javascript.info/1-js/8-oop/5-functional-inheritance/5-override-disable/task.md
2015-03-10 12:36:58 +03:00

17 lines
570 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Переопределите disable
[importance 5]
Переопределите метод `disable` холодильника, чтобы при наличии в нём еды он выдавал ошибку.
Код для проверки:
```js
var fridge = new Fridge(500);
fridge.enable();
fridge.addFood("кус-кус");
fridge.disable(); // ошибка, в холодильнике есть еда
```
В качестве исходного кода используйте решение [предыдущей задачи](/task/add-methods-fridge).