Results 1 to 3 of 3

Thread: structures and classes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: structures and classes

    If the structure is tightly related to the class, it can be declared as in your code however it might be better to declare it inside the class.

    Qt Code:
    1. class readHeader : ... {
    2. public:
    3. struct headerInfo {
    4. int numberOfSamples;
    5. int numberOfLines;
    6. // ...
    7. };
    8.  
    9. headerInfo getHeaderInfo() const { ... }
    10. };
    To copy to clipboard, switch view to plain text mode 

    Note that the fully qualified name of the struct then becomes readHeader::headerInfo.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    OzQTNoob (15th February 2012)

Similar Threads

  1. structures in QT
    By rk0747 in forum General Programming
    Replies: 8
    Last Post: 5th April 2011, 23:04
  2. Data structures with qt4
    By NewLegend in forum Qt Programming
    Replies: 5
    Last Post: 25th July 2010, 21:57
  3. How to properly delete structures?
    By aarelovich in forum General Programming
    Replies: 5
    Last Post: 24th February 2009, 00:39
  4. APIs and Data structures
    By crazymoonboy in forum Qt Programming
    Replies: 0
    Last Post: 30th September 2008, 07:56
  5. Replies: 2
    Last Post: 17th April 2006, 21:30

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.