Thread: to inherit or not to inherit ...

  1. #16
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    Quote Originally Posted by CornedBee View Post
    Scanning my largest and most complex C++ project, the only case where I've used private inheritance is to derive from boost::noncopyable, and that's a very special base class.
    Interesting. I take it that boost::noncopyable is like a policy class to forbid assignment and copy construction? So I guess there could be at least two reasons to derive privately, huh?

    I like the idea of wrapping that into a policy class instead of declaring those two functions private and not defining them. If anything, the clarity alone seems to be worth it.

  2. #17
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Use composition (first example), and use a std::vector of smart pointers, not an array, of TabItems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 12-02-2008, 12:45 PM
  2. Class design (inherit or not)
    By Raigne in forum Game Programming
    Replies: 4
    Last Post: 03-03-2008, 02:10 PM
  3. Friend cannot inherit from private subclass
    By MWAAAHAAA in forum C++ Programming
    Replies: 4
    Last Post: 11-19-2006, 04:44 PM
  4. Replies: 4
    Last Post: 12-29-2002, 12:29 AM
  5. Replies: 1
    Last Post: 11-27-2001, 01:07 PM