• Forum
  • Lounge
  • Is std::iostream a good example of Multi

 
Is std::iostream a good example of Multiple Inheritance?

Could std::iostream be used as an example of good MI?
I very vaguely remember rapidcoder once said no. So I'd like to read more opinions.

(Please keep on topic, thanks.)
Last edited on
MI has many common uses: policy-based design ("Modern C++ Design" is full of basic examples, and similar things can be found in boost.operators and numerous other libraries), mix-ins (such as std::enable_shared_from_this or std::nested_exception), regular template metaprogramming, and, as in the iostreams case, direct is-a relationship.

I'd say iostreams is really more notable as an example of virtual inheritance in the standard library, and for the period (1998) it was a reasonable, although very simple, use case.
Wow, am I in an alternate universe where everything is better? That's quite a positive post for one of my favorite language features :)
Topic archived. No new replies allowed.