{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


10B_W09_exam1 - PIC 10B EXAM 1 KEY Check your TA's name...

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

View Full Document Right Arrow Icon
PIC 10B EXAM 1 January 26, 2009 KEY Check your TA's name: Aleka (10:00)____ Bobby (11:00)____ Josh (12:00)___ You have 50 minutes to complete this exam. No books, notes, or calculators are allowed. Show all work. Incomplete, illegible, or unintelligible answers may receive no credit. There are a total of 50 points on this exam. The declaration of the IntMatrix class used in HW2 is provided for reference. PAGE POSSIBLE POINTS SCORE 1 10 2 6 3 10 4 12 5 12 TOTAL 50
Background image of page 1

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

View Full Document Right Arrow Icon
1 1.) [10 points] Suppose we are creating a class Jedi . Write the single line declaration of each function below, as it would appear in the Jedi class declaration. Declare each function as a member function, if possible. a.) The comparison > for two Jedi objects, as in: if (J1 > J2) bool operator> (const Jedi& right) const; b.) The + function to add two Jedi objects, as in: J1 = J2 + J3; Jedi operator+ (const Jedi& right) const; c.) The += function to add onto a Jedi object, as in: J1 += J2; Jedi& operator+= (const Jedi& right); d.) The input pull >> to read in a Jedi object's data, as in: cin >> J1; (This function will need access to the Jedi class private data.) friend istream& operator>> (istream& in, Jedi& right); e.) The copy constructor for the Jedi class.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}