Original Post
I have a String class derived from a private std::string class. I do this so I can change the interface naming convention to match my own naming style.
My new String class has this function defined:
,class _STL::allocator > &'' exists, but is inaccessible
If my String class isn''t derived from a private std::string then this line works fine.
Why is it trying to use the old std:string''s operator << function and not the new one I have defined for the String class?
BTW, on a curious note, if I change the line to:
std::ostream &operator <<(std::ostream &stream, const String &str)
{
return (stream << str.c_str());
}
I have a LogStream class derived from a public std::ostream class.
When I try to do this:
logstream << str;I get this error message upon compile: type cast'' : conversion from ''class String *'' to ''const class _STL::basic_string
logstream << '' '' << str;then it works fine. I realize that after the first operator << gets called, it returns a ostream class and not a logstream class, since I haven''t redefined the operator << functions in the new derived stream class, but I can''t see why this makes the code compile fine. Any ideas? - Houdini