http://s8.postimg.org/zbfc0h92t/New_Bitmap_Image.png
'contents' can't be initialized whatever I did, thus I can't declare the type in this class
class Window_mgr {
public:
// location ID for each screen on the window
typedef std::vector<Screen>::size_type ScreenIndex;
// reset the Screen at the given position to all blanks
void clear(ScreenIndex);
private:
std::vector<Screen> screens{ Screen (' ', 24, 80) };
};
This is the constructor
Screen::Screen(pos ht, pos wd)
{
contents(ht*wd, ' ');
height = ht;
width = wd;
cursor = 0;
}
Screen::Screen(char c, pos ht, pos wd)
{
contents(ht*wd, c);
height = ht;
width = wd;
cursor = 0;
}
this is the class
class Screen {
public:
friend class Window_mgr;
void some_member() const;
typedef std::string::size_type pos;
Screen(pos ht, pos wd);
Screen(char c, pos ht, pos wd);
Screen set(char);
Screen set(char, pos, pos);
Screen display(std::ostream &os)
{ do_display(os); return *this; }
const Screen &display(std::ostream &os) const
{ do_display(os); return *this; }
char get() const { return contents[cursor]; }
char get(pos ht, pos wd) const;
Screen move(pos r, pos c);
private:
pos cursor;
pos height, width;
std::string contents;
mutable size_t access_ctr;
void do_display(std::ostream &os) const
{ os << contents; }
};