When you have a pointer to a class or a struct, and you want to access the member data or the member functions, you use the -> operator instead of the dot operator "."
There is absolutely no difference in their behaviour. One is used with pointers, and the other is used for uhh...non-pointers.
class Something
{
int value;
Something(int number)
{
value = number;
}
int getValue()
{
return value;
}
};
int main()
{
Something S (5);
S.getValue(); //because S is not a pointer, we use the dot operator
Something* pointerS(5);
pointerS->getValue();//because pointerS is a pointer, we use the -> operator.
}
I felt that I should add that x->y is shorthand for (*y).x
In order to reference member functions/variables using pointers you first need to derefer the pointer. Because the '.' operator has a higher priority than the '*' operator you also need to put a parenthesis around the variable you're using.