I have seen this example from the book:
class Test: private std::string
{
public:
Test():std::string("How?")
{
}
};
int main(int argc, char** argv)
{
Test t;
std::cout<<(std::string&)t<<std::endl;
return 0;
}
I don't know how did it printed "how" when i typecasted the class name? is it because of operators? but i know that when you do private inheritance, the public and protected variables and methods will be considered "private" outside.
So my question is, how did it exactly printed "How" ?
edit :
so who is holding the string value "How" and how was it printed? Because it was printed by typecasting.