Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following properties makes user defined class good ?

(i) Something that has a small and well defined set of operations.
(ii) Something that can be seen as a "Black Box" manipulated exclusively through that set of operations.
(iii) Something whose actual representation could conceivable be modified without affecting the way that set of operation is used.
(iv) Something one might want more than one of.

  • A.(ii) and (iii)
  • B.(i), (ii), (iii) and (iv)
  • C.(i) and (ii)
  • D.(iv) only

Answer: B

All four properties make a good class, so the answer is (i), (ii), (iii) and (iv).

Stroustrup describes a good user-defined type as something with a small, well-defined set of operations; something that can be treated as a black box, used only through those operations; something whose representation could be changed without changing how the operations are used; and something of which one might want more than one instance.

Each of the narrower options leaves out properties from that list.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.