Results 1 to 3 of 3

Thread: What is the difference between (.) and (->) on this code

  1. #1
    Join Date
    Jul 2014
    Posts
    95
    Thanks
    67

    Default What is the difference between (.) and (->) on this code

    Hello
    What is the difference between (.) and (->) on this code??? In both cases, the code runs!!!
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "mainwindow.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. Q_INIT_RESOURCE(sdi);
    8. QApplication app(argc, argv);
    9. app.setApplicationName("SDI Example");
    10. app.setOrganizationName("QtProject");
    11. MainWindow mainWin;
    12. mainWin.show();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "mainwindow.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. Q_INIT_RESOURCE(sdi);
    8. QApplication app(argc, argv);
    9. app.setApplicationName("SDI Example");
    10. app.setOrganizationName("QtProject");
    11. MainWindow *mainWin = new MainWindow;
    12. mainWin->show();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by anda_skoa; 30th August 2014 at 15:00. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: What is the difference between (.) and (->) on this code

    Compare the two line 11s and see how they respectively create the object.
    The line 12s are the matching method call syntax


    Cheers,
    _

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

    rezas1000 (30th August 2014)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What is the difference between (.) and (->) on this code

    Quote Originally Posted by rezas1000 View Post
    Hello
    What is the difference between (.) and (->) on this code??? In both cases, the code runs!!!
    Please ask questions related to C++ rather than Qt in the "General Programming" forum.
    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.


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

    rezas1000 (30th August 2014)

Similar Threads

  1. The difference between tr and translate
    By rezas1000 in forum Newbie
    Replies: 1
    Last Post: 15th August 2014, 12:29
  2. What's the difference?
    By Atomic_Sheep in forum Newbie
    Replies: 3
    Last Post: 6th September 2012, 11:36
  3. Replies: 7
    Last Post: 16th April 2011, 01:33
  4. changes in code not making any difference in output
    By sh123 in forum Qt Programming
    Replies: 13
    Last Post: 10th January 2009, 08:44
  5. Replies: 4
    Last Post: 9th January 2008, 15:28

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.