-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decorator #64
base: master
Are you sure you want to change the base?
decorator #64
Conversation
|
||
Главное правило - объекты должны иметь общий интерфейс. Для примера приведенного выше - это будет отправка сообщения. | ||
|
||
Аналогией из жизни служит одежда. Надевая что-то мы не изменяет базовый класс и не создаем дочерних. Так, закутавшись в свитер станет теплее. А надев сверху плащ - защитимся от дождя. При это сам человек никак не изменяется. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опечатка: " При этоМ сам человек...".
|
||
Класс `FileWriter` наследуется от `OutputStreamWriter`, но не переопределяет метода записи, а лишь создает поток направленный на запись в файл. | ||
|
||
Самом же `OutputStreamWriter`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Несогласованные предложения: "Сам же OutputStreamWriter
".
*/ | ||
public void write(int c) throws IOException { | ||
se.write(c); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы добавил ещё одну закрывающую фигурную скобку чтобы закрыть определение класса. :)
public class BufferedWriter extends Writer { | ||
//some code | ||
|
||
private Writer out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused field. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Годная статья! 👍 😃
Название темы
Введение
Основная часть
Подраздел
Вопрос:
Ответ:
Заключение
Полезные ссылки