# lec0207-big3 - Todays announcements: MP2 available, due...

This preview shows pages 1–5. Sign up to view the full content.

Today’s announcements: MP2 available, due 2/11, 11:59p. Lab03 will be continued this week, and it will be graded. DYB today, 3-5p, Siebel 2407.

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

View Full Document
Operator= the plan: double theRadius; int numAtts; string * attributes; }; // overloaded = _________sphere::operator=(const sphere & rhs){ } int main(){ sphere a, b; // initialize a b = a; return 0; } 250690176 4 wet rocky rotating inhabited 2.5 3 b a Red Juicy crunchy
Operator=: class sphere{ public: sphere(); sphere(double r); sphere(const sphere & orig); ~sphere(); private: double theRadius; int numAtts; string * attributes; }; // overloaded = sphere & sphere::operator=(const sphere & rhs){ //protect against re-assignment //clear lhs //copy rhs //return a helpful value } int main(){ sphere a, b; // initialize a b = a; return 0; }

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

View Full Document
Operator=: (review) class sphere{ public: sphere(); sphere(double r); sphere(const sphere & orig); ~sphere(); private: double theRadius; int numAtts; string * attributes; }; ________ sphere::operator=(______________ rhs){ if (this != &rhs) { clear(); copy(rhs); } //return a helpful value } Why not (*this != rhs) ?
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/26/2012 for the course CS CS 225 taught by Professor Heeren during the Spring '09 term at University of Illinois, Urbana Champaign.

### Page1 / 12

lec0207-big3 - Todays announcements: MP2 available, due...

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

View Full Document
Ask a homework question - tutors are online