previous |
start |
next
"Is-a" / "Has-a" /"Uses
- The "is-a" relationship is inheritance, use extends
-a circle is an ellipse
-a car is a vehicle
- The "has-a" relationship is association, use an instance
variable
-a tire has a circle as its boundary
-a car has a set of tire
- The "uses" relationship is dependency
-an Applet uses a Graphics object
Example:
class Car extends Vehicle //inheritance "is-a"
{
...
private Tire[] tires; //instance variable "has-a"
}
previous |
start |
next