1. what is the relationship between classes ?
a. dependency
dependency means Class A use Class B as a reference data in method .So generally we wite a method like action( B bObject){{}.
b. association(general )
one to one
one to multi
one direction
double direction
c. aggregation(has a /weak association/part of body /different life circle )
d. composition (contains a/ strong association/part of body /same life circle )
2.how to show the relationship by codes?
# dependency :soldier use a gun to kill enemy.
class Soldier{
public void killEnemy( Gun gun){
}
}
class Gun{
}
#association:army has soldiers
class Army{
private Soldier[];
}
6.key points of realtionships ?
to be continue .........