I meant within the object, like I am accessing the class variable in one of the class's member functions. I have tried both versions, and they both work, but I am curious which is more preferable. Thanks in advance.
Is one more preferable than the other, or is it a matter of opinion?
In most cases it is just a matter of opinion (preference). My preference is to only use the this-> syntax when absolutely necessary such as when you have a parameter with the same name.
By default, those guys are private consequently other objects cannot access them.
Yes classes have default private access, however in the snippets shown the only access being attempted is from within the class so the access specifier is not relevant to the question asked.
Yes classes have default private access, however in the snippets shown the only access being attempted is from within the class so the access specifier is not relevant to the question asked.