to inherit or not to inherit ...

This is a discussion on to inherit or not to inherit ... within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by CornedBee Scanning my largest and most complex C++ project, the only case where I've used private inheritance ...

  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.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21