Transferred from: http://blog.csdn.net/gyymen/article/details/4962873
First introduce the structure in C + +. For a structure:
struct mystruct{ int member_a;};
If you have a variable mystruct s, you can use the member elements in the following:
S.member_a = 1;
If you use pointer method access, such as MyStruct * PS, then the same access must use the following form:
(*ps). member_a = 1;
Or
When defining a class object as a pointer object, C + + uses a pointer to a member of the class, which needs to be used when defining a generic object. Points to a member in a class.
For example:
Class A{public Play ();}
If defined as follows:
A *p is used: P->play (); The left is the structure pointer.
A p is used: P.paly (); On the left is the structure variable.
Summarize:
Arrow (): The left must be a pointer;
Point number (.): The left must be an entity.
[C + +] The difference between "arrow" and "dot (.)"