Results 1 to 7 of 7

Thread: Virtual destructors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    33
    Thanks
    10
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Virtual destructors

    This is an issue that has been bugging me for some time since starting to use Qt. Why do so many of the classes not have virtual destructors, since it seems clear that they may be used as base classes for derived classes?

    An obvious example is QWidget. Clearly this is a base class for many other classes, but according the documentation, the destructor is not virtual. My understanding has always been is that if a class can be a base class for other classes, the destructor should always be virtual. Is there some essential gap in my knowledge of C++ programming (surely not!)?

    Thanks for any input.
    Jim L
    Seattle, WA

  2. The following user says thank you to jml for this useful post:

    bunjee (1st November 2009)

Similar Threads

  1. Cost of pure virtual
    By ShaChris23 in forum General Programming
    Replies: 4
    Last Post: 4th November 2007, 18:20
  2. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  3. Compiling error
    By vfernandez in forum Newbie
    Replies: 2
    Last Post: 9th March 2007, 21:02
  4. inheritance, pure virtual
    By TheKedge in forum General Programming
    Replies: 2
    Last Post: 18th January 2007, 11:20
  5. link error for visual studio.net 2003
    By berlin in forum Newbie
    Replies: 9
    Last Post: 29th September 2006, 16:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.