August 2012
Intermediate to advanced
976 pages
30h 17m
English
*thisNext we’ll add functions to set the character at the cursor or at a given location:
class Screen {public: Screen &set(char); Screen &set(pos, pos, char); // other members as before};inline Screen &Screen::set(char c){ contents[cursor] = c; // set the new value at the current cursor location return *this; // return this object as an lvalue}inline Screen &Screen::set(pos r, pos col, char ch){ contents[r*width + col] = ch; // set specified location to given value return *this; // return this object as an lvalue}
Like the move operation, our set members return a reference ...
Read now
Unlock full access