1) You have been asked to implement a user-interface component ButtonCanvas which is both a button that can be clicked by the user and a canvas which the user can draw on. Your existing code contains a Button class and a Canvas class. Both of this extend GuiComponent.
a) ButtonCanvas should be built using multiple inheritance. What does this mean in this context? (3 marks)
b) Give two reasons why this might be desirable. (3 marks)
c) Give two complexities that arise in this case (3 marks)
d) Java interfaces originally contained only abstract methods and static final fields. How did this restrictions avoid the complexities of extending multiple classes?
Comments
Leave a comment