Closed anchengyang closed 1 year ago
I believe as UIWidget is not an abstract class, any abstract methods in its parent classes or implemented interfaces will have to be implemented (else the code won't compile). Since update() is not implemented in ProgressWatcher, it will have to be implemented in UiWidget.
In the tutorial week 8 solution you showed, bill() need not appear in Item if bill() is not implemented in item. This is allowed as Item is still an abstract class. Any (non-abstract) class that inherits from Item will have to implement the bill() method, so the bill() method will appear in those classes instead.
@joellow88 ohh thanks so if the question says that the abstract class Item
implements the method bill()
method, i will need to show bill()
in the diagram?
@joellow88 ohh thanks so if the question says that the abstract class
Item
implements the methodbill()
method, i will need to showbill()
in the diagram?
@anchengyang Yes.
@joellow88 @damithc thank you!
Hi all, I would like to check that based on the practice paper part 2, the
UiWidget
inherits from theProgressWatcher
class. Why does it contain theupdate()
method from theWatcher
interface? In tutorial, we were told that we do not need to include methods that we inherited from interfaces or abstract classes. This can be seen fromItem
implementingBillable
.Here are pictures from the practice paper part 2 answer as well as tutorial week 8.