Home Inheriting from a C++ class with no virtual functions
 We have a log implementation that's based on std::ostream with a custom stream buffer. We implement our application's instance of the log class via a Schwarz counter. To avoid coupling our lower level classes to our log implementation, we can pass a reference to a std::ostream. In this way our lower level classes can log to std::cout, std::cerr or to the instance created via the Schwarz counter. I have one problem with this. The log implementation sets its severity via an overload of the stream operator: // Overload the << operator to set the log message severity inline CLogStream& operator << (CLogStream& myLogStream, eMsgType::type msgTypeCurrent) { myLogStream.SetMsgTypeCurrent(msgTypeCurrent); return ( myLogStream ) ; }  This allows us to use the logger like this: CLog::Main << CLog::MSG_FATAL << "Fatal error" << std::endl;  I'd like to create a reference to our app's instance of the log which is locked to a particular severity. That way, I can pass our utility classes two std::ostream references. One of these would be used for normal reporting and the other for error reporting. These could be set to std::cout and std::cerr, or to some kind of object referring to our log object instance. Unfortunately the std::ostream operator << aren't virtual as far as I'm aware, so I'm not sure how to design such an object. Any thoughts?