Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Want to know difference between the member functions of QStringList

    General and Desktop
    3
    3
    329
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Phadnis last edited by A Former User

      Hi,
      what is the difference between QStringList::QStringList(const QList<QString> &other) and QStringList &QStringList::operator=(const QList<QString> &other)
      With Thanks

      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by

        First one builds the Qstringlist while creating QStringList object itself from the list QList values. It is like copy constructor. Here there no two QStringList Objects exist here.
        In the second case it uses operator overloading to copy contents of One StringList to Other StringList. Here there are two QStringList objects here. It is copying from one QStringList to Other QStringList object. It is object copy.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply Reply Quote 8
        • VRonin
          VRonin last edited by

          http://www.cplusplus.com/doc/tutorial/classes2/

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply Reply Quote 2
          • First post
            Last post