Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. [Solved] Basic question, what’s the difference between the . and the :: and the ->
Qt 6.11 is out! See what's new in the release blog

[Solved] Basic question, what’s the difference between the . and the :: and the ->

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    thistleknot
    wrote on last edited by
    #1

    This is what I believe they mean.

    .

    object accessor

    Such as

    objectname.membervariable

    and the ::

    is a way to access another object's function.

    I see - > used in QT a lot. It appears to work in a similar manner, but I see it primarily used with ui->

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thiberi0
      wrote on last edited by
      #2

      "." is used to access a object member

      "::" is used to access a class member( when a instance of class isn't necessary)

      "->" is used to access a dereference a pointer to something = "(* .)"

      Maybe this will help:
      http://en.cppreference.com/w/cpp/language/operator_member_access

      thiberi0

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved