












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













Complex & rhs);
// Error c1 << cout;c1 << cout << 2; // Errorreturn 0;
(ostream
&^ os){ os^ <<^ ‘(‘
<<^ real<< ‘,’ <<^ img
ostream
&^ operator
(ostream
&^ os,^ const^ Complex&^
c);
const
Note: return typeis NOT^ const
c1(1.01,
c2(0.01,
cout^ << c1^ <<^ endl^ << c2;
Stream Extraction Operator^ ►Overloading
istream
&^ operator
^ (istream
&^ i,^ Complex
c);
Note: this objectis NOT^ const
Stream Extraction Operator istream^
&^ operator
<<^ (istream &^ in,^ Complex
&^ c){ in^ >>^ c.real;in^ >>^ c.img;return^ in; }
Stream Extraction Operator^ Output:^ ( 1.0025 , 0.0241 )
(lhs.img == rhs.img)){return true;} elsereturn false;}
(img != c.img)){return true;} elsereturn false;}