// want to know what to initialize extracted_text with here
You cannot do that here. Class members are initialized before the constructors body is executed. If you want to initialize members you need to do that before the contructor runs.
what can the istringstream type extracted_text be initialized to?
Here you can find a list of constructors, pick one: std::basic_istringstream::basic_istringstream. For example you can initialize it with a std::string
, (3) on the list:
Uses a copy of str as initial contents of the underlying string device. The underlying basic_stringbuf object is constructed as basic_stringbuf<Char,Traits,Allocator>(str, mode | std::ios_base::in).
class user_input
{
std::string input_text;
std::istringstream extracted_text;
public:
user_input() : input_text("NULL"),extracted_text("hello world")
// ^^ member initializer list
{
}
};
What do istringstreams or stringstreams in general initialize to by default in C++?
The default constructor (same link):
Default constructor. Constructs new underlying string device with the default open mode
If that is what you want you do not have to provide an initializer.
Read more on constructors and the member initializer list here. I didn't mention default member initializers about which you can read here.