For example as shown below.
> Is the book wrong?
Yes.
----------------------------------------------------------------------------
#include <stddef.h>
#include <vector>
using ScreenIndex = ptrdiff_t; // Not the silly
`std::vector<Screen>::size_type`
class Screen;
namespace window_mgr_screen_ops
{
void clear( Screen& );
};
class Screen
{
friend void window_mgr_screen_ops::clear( Screen& );
// ... rest of the Screen class
public:
Screen( int, int, char );
};
class Window_mgr
{
std::vector<Screen> screens{ Screen{ 24, 80, ' ' } };
public:
// reset the Screen at the given position to all blanks
void clear( ScreenIndex const i )
{
window_mgr_screen_ops::clear( screens[i] );
}
};
----------------------------------------------------------------------------
Cheers & hth.,
- Alf