7 question 5 oo design and stl part a 5 points for

This preview shows 7 out of 9 pages.

7
Image of page 7

Subscribe to view the full document.

Question 5: OO Design and STL Part A (5 points): For each statement, indicate true or false. Methods should be noun-like. Changing a good design to accomodate different features should be a massive undertaking: new changes are best redesigned from the ground up. The “monolithic” design pattern is useful for minimizing the cognitive load on a code maintainer. Computer scientists should seek to special case as many things as possible. Design patterns are only useful in C++. Part B (8 points): The C++ STL vector class has no method to remove a particular element from the vector. The STL provides a different means of removing a specific element. Briefly explain how this is accomplished. 8
Image of page 8
Part C (7 points): Name the design pattern shown below: class A { virtual X* makeX() = 0; virtual Y* makeY() = 0; }; class OneThing : public A { virtual X* makeX() { return new XOne(); } virtual Y* makeY() { return new YOne(); } }; .... A* a = new OneThing(); ..... X * x = a->makeX(); ... 9
Image of page 9
You've reached the end of this preview.
  • Fall '08
  • hershman

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern