CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Threaded View

  1. #6
    Join Date
    May 2009
    Posts
    2,413

    Re: Common base class + abstract interface class

    Quote Originally Posted by D_Drmmr View Post
    I'd say your design is bad.
    Using a top base class is quite common in OO designs actually. In both Java and C# it's even built into the language. The best known C++ example is maybe Qt where every class inherits a common top class called QObject.

    I'm using the top class design strategy to uniformly handle a global memory management scheme based on the Boost intrusive smartpointers. It works very well, almost like full GC. In fact it's only since I started with this I felt really at home with C++. It's simple to use. It's efficient, close to bald pointer usage. Object ownership is a no-brainer. No risk for memory leaks. It's threadsafe. It's not in the way of multiple inheritance. No problems with upcasting. No problems handling this-pointers.

    I wouldn't call the use of top classes bad design. But resorting to downcasting definately is.
    Last edited by nuzzle; May 29th, 2013 at 03:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured