Results 1 to 2 of 2

Thread: question about inheritance

  1. #1
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default question about inheritance

    Hello.

    I have a question about inheritance.

    I was having an error with vtable telling:
    Undefined reference to vtable .....

    I checked in the forum about this and i found that the Q_OBJECT had to be included. I had it included in the clases which inherit from the base class, but not in the base class.

    I included the Q_OBJECT in the base class and it is working now. I would like to know the reason, is there a rule which specify that the base class have to include the Q_OBJECT if any of its descendats need it?

    Thank you in advanced.

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: question about inheritance

    QT uses a system known as meta-object system. Any QT class which is derived, directly or indirectly from QObject has to have Q_OBJECT macro! it includes a lot of functions that will only be defined if this macro is there..

  3. The following user says thank you to talk2amulya for this useful post:

    adamatic (16th February 2009)

Similar Threads

  1. Inheritance Question
    By RY in forum Newbie
    Replies: 2
    Last Post: 3rd October 2008, 08:13
  2. Plugin implementation question
    By JPNaude in forum Qt Programming
    Replies: 12
    Last Post: 27th August 2008, 20:24
  3. SQL Question
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2008, 19:36
  4. How much inheritance do you use?
    By Michiel in forum General Programming
    Replies: 8
    Last Post: 1st August 2006, 22:29

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.