(Java)
An Account object contains a String object representing the account owner’s name, an Address object representing the owner’s home address and the bank location. What kind of class relationship is this?
Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: An Account object contains a String object representing the account owner’s name, an Address object repres…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
A.
Dependency
B.
Aggregation
C.
Association
D.
Inheritance
Expert Answer
Answer is B. Aggregation
Class Account has an instance of class Address. This is a kind of association relationship. But the relationship is unidirectional only. Account is having HAS-A relationship on Address.
In any case Address cannot have HAS-A relationship with Account. This is a special case of Association which is called Aggregation