Q:

Decorator design pattern java overriding methods question

I need help understanding this example for a decorator:
    package design.decorator;
public class FillColorDecorator extends ShapeDecorator {
      protected Color color;
      public FillColorDecorator(Shape decoratedShape, Color color) {
            super(decoratedShape);
            this.color = color;
      }
      @Override
      public void draw() {
            decoratedShape.draw();
            System.out.println("Fill Color: " + color);
      }
      // no change in the functionality
      // we can add in the functionality if we like. there is no restriction
      // except we need to maintain the structure of the Shape APIs
      @Override
      public void resize() {
      decoratedShape.resize();
      }
      @Override
      public String description() {
      return decoratedShape.description() + " filled with " + color + " color.";
      }
      // no change in the functionality
      @Override
      public boolean isHide() {
      return decoratedShape.isHide();
      }
}

This example is taken from this website:
https://dzone.com/articles/decorator-design-pattern-in-java
I just don't understand why they bother to implement the methods with unchanged functionality. For exmple:
return decoratedShape.isHide();

Why is this necessary?
It seems to me that deleting this and not overriding the unchanged methods will do the job fine.
Thanks.

A:

You have to implement them because in this case ShapeDecorator is only an abstract class implements Shape: it simply provide a uniform way to store the decorated Shape:
package design.decorator;

public abstract class ShapeDecorator implements Shape {
      protected Shape decoratedShape;
      public ShapeDecorator(Shape decoratedShape) {
            super();
            this.decoratedShape = decoratedShape;
      }
}

You would not need it if in the ShapeDecorator class you were already doing that.

