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.
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.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development