c109f04t1 - CSE 109 Test 1 Monday 4 October 2004

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 109 Test 1 Monday 4 October 2004 <<<<<<<<<<<<<<<<<<<<<SUGGESTED ANSWERS 1. Assume that we want to compile a program and each of the classes it uses separately, assume we have the four classes A, B, C, and D, assume that the declarations for a class are in a .h file with the corresponding letter (e.g., a.h) and that the code for a non-templated class is in a .cc file (e.g., a.cc), assume that class B declares variable(s) of type A, assume that class C declares variables of type A and of type B, assume that class D declares variable(s) of type C, and assume the code for the program is in the file prog.cc. a) Write the makefile assuming the program uses class D, where all the classes are non-templated. b) Write the makefile assuming the program uses classes B and C, where class C is templated and all the other classes are not templated. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< a. OPTS= -c -Wall -Werror prog: prog.o a.o b.o c.o d.o g++ -o prog prog.o a.o b.o c.o d.o prog.o: prog.cc a.h b.h c.h d.h g++ $(OPTS) prog.cc a.o: a.h a.cc g++ $(OPTS) a.cc b.o: a.h b.h b.cc g++ $(OPTS) b.cc c.o: a.h b.h c.h c.cc g++ $(OPTS) c.cc d.o: a.h b.h c.h d.h d.cc
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ 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