Results 1 to 7 of 7

Thread: Pass by reference

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Pass by reference

    As far as I know there is no other way around. "A &a" is how you do it in C++.
    J-P Nurmi

  2. #2
    Join Date
    Sep 2006
    Posts
    339
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    15
    Thanked 21 Times in 16 Posts

    Default Re: Pass by reference

    Quote Originally Posted by jpn View Post
    As far as I know there is no other way around. "A &a" is how you do it in C++.
    That is fine, but I need to make my class smart enough to provide such functionality. Is there some way I can implement my class like that???

    Thanks

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Pass by reference

    What do you mean?
    You just pass the parameter by reference...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Pass by reference

    Quote Originally Posted by vermarajeev View Post
    I need to make my class smart enough to provide such functionality.
    This is counter intuitive in C++ and might lead to mistakes and confusion, but if you really want it, just implement data sharing class without copy-on-write mechanism (AFAIR it's called a single state class).

Similar Threads

  1. Can't compile custom class derived from QGLWidget
    By stealth86 in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2007, 17:55
  2. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  3. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  4. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36
  5. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

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.