Which four statements are true? (Choose four.)
A. Has-a relationships should never be encapsulated.
B. Has-a relationships should be implemented using inheritance.
C. Has-a relationships can be implemented using instance variables.
D. Is-a relationships can be implemented using the extends keyword.
E. Is-a relationships can be implemented using the implements keyword.
F. The relationship between Movie and Actress is an example of an is-a relationship.
G. An array or a collection can be used to implement a one-to-many has-a relationship.
答案:CDEG
解析:
X A - Has-a 跟封裝沒有關係,好的物件導向程式都應該有良好的封裝
X B - 用繼承關係(inheritanc)來實作(implemented),好像怪怪的
X F - Movie and Actress 是 Has-a 的關係
0 意見:
張貼留言