There is no difference in C. However, in C ++, the -> operator can be overloaded, while the element select statement . can not.
Thus, in (*foo)->bar *foo one could designate a class object that acts as an intelligent pointer, although this will not happen if foo is an iterator over a standard container of C ++ pointers, which means that *foo evaluates pointer.
And in (**foo).bar , **foo should be an object of a class with a member called bar (which is available).
Unary * can also be overloaded (as the iterator foo , an object of the class, returns the object that it refers to).
In other words, expressions may differ in meaning, but if *foo is a pointer to the / struct class, then the equivalence inherited from the C language is applied: (*ptr).member equivalent to ptr->member .
Kaz
source share