![]() |
CMPT 212
Spring 1998
|
sentence a; sentence b; ... a = b; // These two lines are a.operator=(b); // the same.
sentence a; sentence b; sentence c; ... a = b = c; ... while ((a = readSentence()) != badSentence) { ... }
ostream& operator<<(ostream& os, const sentence& s) { os << *(s.words); return os; }
sentence a; cout << a. // These two lines are operator<<(cout, a); // the same.
sentence a; int i; float f; cout << i << a << f; // These two lines are ((cout << i) << a) << f; // the same.
istream& operator>>(istream& is, sentence& s) { ... return is; }
const myClass1& operator+(const myClass2& leftOp, const myClass3& rightOp); ... myClass1 a; myClass2 b; myClass3 c; ... a = b + c;
const myClass1& myClass2::operator+(const myClass3& rightOp); ... myClass1 a; myClass2 b; myClass3 c; ... a = b + c;
![]() Return to lecture notes index |
|
This page is maintained by simpson@cs.sfu.ca. | Last updated on 18 Feb 1998. |