. :: -> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

. :: ->

When using c++ classes, when do I use the dot(.) double colon (::) and the arrow (->)?

1st Mar 2019, 4:03 PM
SamDotMp3
SamDotMp3 - avatar
1 Answer
+ 4
The dot is for accessing members of an object. The double colon is to access a class' member or a namespace's Finally the arrow is to access an object's member from a pointer. my_personj.setName("something"); person_ptr->printName(); Person::myMethod();
1st Mar 2019, 4:16 PM
voidneo