4

I'm in a course of C++, I found this a little bit confusing.

We're studying structs, and, if we create a new object from that structure, we can access to its properties using for example foo.property, but I found that to access to the struct statements, they use the :: operator, and I only found a difference between .and :: in the object they are accessing, but reading a little more about ::, I found that you can access to global context's variables or functions using ::property, but that's what I don't get, that it means that doing class::property is accessing to that property to the global context of the program, or is accessing to the global property inside the class, like doing obj.property?

So, what are the differences between . and ::?

I come from JavaScript, so for my this is a little bit complex, and I didn't found a clear answer for this, and I don't found a clear response about what is ::in general and its use.

user2633604
  • 111
  • 1
  • 7
  • 4
    Holy run-on, batman! Anyway: http://stackoverflow.com/questions/4984600/when-do-i-use-a-dot-arrow-or-double-colon-to-refer-to-members-of-a-class-in-c –  Aug 05 '13 at 13:17
  • You need to read about namespaces and static members/functions in C++ – piokuc Aug 05 '13 at 13:17
  • 1
    Yeah, I get it from here http://stackoverflow.com/questions/11902791/what-is-the-difference-between-and-in-c Thanks! I don't know why is so difficult found information about this, if there's post about that here :S – user2633604 Aug 05 '13 at 13:21
  • 2
    Yay! :D cool. Keep learning and let's rule the software world! – Natan Streppel Aug 05 '13 at 13:24

0 Answers0