I've run across this pointer construction and I'm not familiar with it. Can someone explain please.
void Test_GPS::begin(uint16_t baud)
{
gpspointer->begin(baud);
}
What does the ->
do? And it seems recursive.
I've run across this pointer construction and I'm not familiar with it. Can someone explain please.
void Test_GPS::begin(uint16_t baud)
{
gpspointer->begin(baud);
}
What does the ->
do? And it seems recursive.
You should really get a C/C++ Book and learn your language, before you start programming.
->
is the dereferencing operator for Pointers. When you have a pointer gpspointer
the expression (*gpspointer)
returns the object gpspointer
points to. (*gpspointer).begin(baud)
is the same as gpspointer->begin(baud)
. It just increases readability.
Your code will recurse only if gpspointer=this
.