您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Apply Index

Apply Page # 7

Exercise 4 — Multiple inheritance

Draw a UML diagram to show the relationships between classes InputReceiver , MyButton , Component , image and Icon as described in the text.

"Any object that can receive input from the user is a subclass of InputReceiver . Examples might include buttons, menus, window borders, etc. Any object that can be displayed in a window is a subclass of Component . The class called MyButton displays a button in a window. This is a subclass of InputReceiver (because we can activate the button by pressing the space bar, or clicking the mouse). It is a subclass of Component because it can be displayed in a window. Icon and image are subclasses of Component , but not subclasses of InputReceiver . "

Where is the multiple inheritance in this system? Show it in a UML diagram.

Can the system be reorganised so that it does not exhibit multiple inheritance?

Discussion of Exercise 4
Back to content

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg