Results 1 to 4 of 4

Thread: Class vs include

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Feb 2014
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Class vs include

    What you are seeing is a forward declaration. Like the poster above me mentioned, since the header only references the class, you only need to include the "class QList". However, you will notice that when the class is actually used (in the .cpp file for example, the #include <QList> must be included. People do this because it reduces compile times since you no longer need to include the header of a forward declared class in that files, only the file where the class (QList) is actually used. While not a big deal on pet projects, if you ever develop for a commercial entity, you're talking about serious time saved.

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

    otttx33 (11th February 2014)

Similar Threads

  1. Replies: 5
    Last Post: 13th January 2014, 09:24
  2. show object (scene) in widget in class class mainwindow
    By rimie23 in forum Qt Programming
    Replies: 8
    Last Post: 1st May 2012, 16:15
  3. Replies: 1
    Last Post: 20th January 2012, 04:39
  4. Replies: 3
    Last Post: 27th December 2008, 19:34
  5. #include class
    By mickey in forum General Programming
    Replies: 6
    Last Post: 11th June 2006, 12:36

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.