Results 1 to 2 of 2

Thread: a simple question:about 'out'

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default a simple question:about 'out'

    I want to output two results in a function,so I define it as follows:

    bool getData(out QList<float> A,out QList<float> B)
    {
    }

    but error occur:
    error C2061: syntax error : identifier'out'.
    How to define 'out' para in a funtion?
    thank you.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: a simple question:about 'out'

    bool getData(out QList<float> A,out QList<float> B)
    Open your book, find out why this is not valid C++ syntax.

    Usually, if you want to pass in a variable that you will assign inside a function, you use either a reference or a pointer:

    Qt Code:
    1. bool getData( QList<float> & A, QList<float> & B )
    2.  
    3. // or
    4.  
    5. bool getData( QList<float> * A, QList<float> * B )
    To copy to clipboard, switch view to plain text mode 
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Simple Mdi question
    By slqh in forum Newbie
    Replies: 6
    Last Post: 17th December 2012, 15:28
  2. Simple question
    By zorro68 in forum Qt Programming
    Replies: 2
    Last Post: 22nd February 2011, 12:42
  3. simple question
    By assismvla in forum Newbie
    Replies: 5
    Last Post: 30th May 2010, 23:30
  4. A simple question
    By bruccutler in forum Newbie
    Replies: 1
    Last Post: 6th April 2007, 08:54
  5. Another simple question...
    By Dark_Tower in forum Newbie
    Replies: 5
    Last Post: 31st March 2006, 16:13

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.