I know Aggregation is a has-a relationship, but I encountered a question in a test which did not make sense (and had grammatical mistakes as well)
Which of the following statements correctly describe the concept of aggregation in OOP?
- A Splitting a class into a several sub classes
- B Creating one piece of code that works with all similar objects
- C Accessing data only through methods
- D Combining several classes to create a new class
- E Creating a new class from an existing class
I think;
- A Could be true.
- B Sounds like inheritance.
- C Seems like property.
- D Could be true.
- E Could be true.
I'm uncertain how the has-a relationship translates into actual code in these statements. Any ideas?
Best Answer