nus-cs2103-AY2324S1 / forum

10 stars 0 forks source link

Is +update(int) necessary in the UI Widget class? #556

Closed MagnificentCreature closed 9 months ago

MagnificentCreature commented 9 months ago

image We already know it inherits from the abstract interface

TeeRenJing commented 9 months ago

Another hypothetical scenario I can think of: abstract class ProgressWatcher could have provided an implementation of the +update(int) method, while the UiWidget just extends the abstract class ProgressWatcher without overriding the +update(int) method in ProgressWatcher.

Now the +update(int) method will be written in ProgressWatcher instead. Hence I think it is necessary to show where there has been an implementation of the +update(int) method.

Extending from my scenario, if the UiWidget overrides the +update(int) method in ProgressWatcher. I think +update(int) method will have to be written in both ProgressWatcher and UiWidget.

MagnificentCreature commented 9 months ago

Thanks, but without knowing that, would we be penalised if we don't write it for either, or write it for both?

Likewise actually, will we be penalised if we do not write the fields for the classes? Since they are optional also right?

damithc commented 9 months ago

Thanks, but without knowing that, would we be penalised if we don't write it for either, or write it for both?

@MagnificentCreature The code of Activity, Watcher, ProgressWatcher are given in the question. So, some things are known already.

MagnificentCreature commented 9 months ago

I see, because we know that ProgressWatcher DID NOT override it, so we know UiWidget must override it?

damithc commented 9 months ago

I see, because we know that ProgressWatcher DID NOT override it, so we know UiWidget must override it?

@MagnificentCreature Yes, that's the idea.

MagnificentCreature commented 9 months ago

Thank you