Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

decorator #64

wants to merge 2 commits into from

Conversation

mikhailchuryakov
Copy link

Название темы

Введение

Основная часть

Подраздел


Вопрос:

Ответ:


Заключение

Полезные ссылки


Главное правило - объекты должны иметь общий интерфейс. Для примера приведенного выше - это будет отправка сообщения.

Аналогией из жизни служит одежда. Надевая что-то мы не изменяет базовый класс и не создаем дочерних. Так, закутавшись в свитер станет теплее. А надев сверху плащ - защитимся от дождя. При это сам человек никак не изменяется.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опечатка: " При этоМ сам человек...".


Класс `FileWriter` наследуется от `OutputStreamWriter`, но не переопределяет метода записи, а лишь создает поток направленный на запись в файл.

Самом же `OutputStreamWriter`:
Copy link
Contributor

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);
      }
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused field. :)

Copy link
Contributor

@gabriel-fallen gabriel-fallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Годная статья! 👍 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants