GIVEN:
A class MyStream
derived of std::basic_istream<>
contains a pointer subject
to a std::basic_istream<>
object. It shall respond to tellg()
and read()
with modified content from the corresponding responses of subject
.
template <class T> MyStream :
public std::basic_istream<typename T::char_type, typename T::traits_type> {
std::basic::istream<...>* subject;
...
};
PROBLEM: The functions tellg()
, seekg()
and read()
as well as the status-flag functions are not virtual.
QUESTION: How can a MyStream
object pass tell, seek, and read to subject, forward the response to the caller and modifiy the status flags so that they correspond to the flags of subject
?