86.2k views
5 votes
Which of the following statements best describes HAS-A association relationship? A reference type X that contains another reference type Y A reference type X that extends another reference type Y A reference type X that has another reference type Y as an instance variable None of the above

1 Answer

1 vote

Final answer:

The HAS-A association relationship in object-oriented programming means that a class has a reference to another class as an instance variable, representing a usage or aggregation relationship.

Step-by-step explanation:

The HAS-A association relationship is best described by the statement: 'A reference type X that has another reference type Y as an instance variable.' This relationship is a design principle in object-oriented programming that indicates a class X has a reference to another class Y within it, but class X does not inherit from class Y. An example of this association would be a class Car that has an instance variable of type Engine; this means that every Car HAS-A Engine.

User Fejs
by
7.9k points