Extending AmigoOutputStream

  • 10
  • Locked
Using the wrapper (decorator) design pattern, extend the functionality of AmigoOutputStream. In the QuestionFileOutputStream class, the following functionality should be implemented for the close() method: 1. Display "Do you really want to close the stream? Y/N". 2. Read a line. 3. If the read line
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
29 September 2021, 01:33
This is really interesting stuff. So what this is about is basically creating a variant of an OutputStream that, when faced with a request to close the stream, it asks the user for confirmation before doing so. What we're learning is what to do when we have a class we want to use but we want one small thing about it to operate differently from how the class normally operates. I'm not entirely sure I understand when I would do this and when I would just create a class that extends a class and override the method I want to change. But I'm sure that will become clearer to me as I progress.
Petros
Level 23 , Columbia, United States
19 August 2020, 20:42
Man these are brutal. Hope I understand them one day.
iqbalhussain
Level 22 , Peshawar, Pakistan
22 December 2018, 18:13
what is meant by delegated here?