Which Man class properly represents the relationship "Man has a best friend who is a Dog"?

Which Man class properly represents the relationship “Man has a best friend who is a Dog”?

Which Man class properly represents the relationship “Man has a best friend who is a Dog”?

A.
class Man extends Dog { }

B.
class Man implements Dog { }

C.
class Man { private BestFriend dog; }

D.
class Man { private Dog bestFriend; }

E.
class Man { private Dog<bestFriend>; }

F.
class Man { private BestFriend<dog>; }

Explanation:
1) Has-a is implemented using instance variables. (A and B are excluded answers)
2) best friend who is-a Dog -> the variable bestFriend has to be from Dog class. (C, E and F are excluded answers)



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Juan Luis Olguin

Juan Luis Olguin

D