Exam_2008-03-26_Answers - Examination 6 hgskolepong/credits...

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

View Full Document Right Arrow Icon
Examination 6 högskolepoäng/credits CDT310 Foundations of Software Engineering CDT311 Game Development - project course Date: 2008-03-26, 14:30- 19:30 Page 1(2) Solution to Assignment 4. a) Class diagram A -c1: CLogic1 -c2: CLogic2 +calculate(y: int) CCalculator +add(a: int, b: int) +inc(a: int) CLogic1 #c: CCalculator +calculate(a: int, b: int) CLogic2 #c 1 -c2 1 -c1 1 Note that there are several ways to show the member variables, you could choose between: * use the notation in the class "-c1:CLogic1" OR * use the annotations shown on the aggregation arrows. b) Sequence diagram (next page) Note the order of the calls: the innermost call (to c1.calculate(2,1) ) is executed first, which returns “3”. This value is then used as a parameter in the call to c2.calculate(3,0) . A common mistake is to call c2.calculate first, with c1.calculate(2,1) as a parameter, and then somehow call c1.calculate from within the c2.calculate() method. This is not possible: in a strongly typed, imperative/OO-language like C, C++,
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 12/09/2011 for the course ECE 651 taught by Professor Sign during the Fall '11 term at Tsinghua University.

Page1 / 2

Exam_2008-03-26_Answers - Examination 6 hgskolepong/credits...

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