
On 01.09.2010 18:55, Ilya Sokolov wrote:
class stream // I don't like this name { public: virtual ~stream() {}; // create_child() calls this method virtual void create_parent_and_child_end(handle&, handle&); };
Another try: class stream { public: virtual ~stream() {}; virtual void set_fileno(int); virtual std::pair<handle, handle> create_parent_and_child_end(); }; class inherit : public stream { public: void set_fileno(int); void create_parent_and_child_end(handle& pe, handle& ce) { handle pe; handle ce(GetStdHandle(DWORD(fileno_ - 10))); return std::make_pair(pe, ce); }; private: int fileno_; }; class context { public: context& stdin(stream s) { s.set_fileno(0); stdin_ = s; return *this; } ... };