c109f04t1 - CSE 109 Test 1 Monday 4 October 2004...

Info iconThis 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 g++ $(OPTS) d.cc b. OPTS= -c -Wall -Werror prog: -o prog prog.o b.o a.o
Background image of page 1

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

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

This note was uploaded on 03/09/2008 for the course CSE 109 taught by Professor Kay during the Spring '08 term at Lehigh University .

Page1 / 3

c109f04t1 - CSE 109 Test 1 Monday 4 October 2004...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online