I am working with the Makeblock Ultimate 2.0 MegaPi. As I examine the firmware code, I find this line of code . . .
"distance = us->distanceCm();"
The firmware code does compile to completion, however I am not aware of the operator "->"
Does any know what this code is?
-> is to call a method on an object from a pointer to it. So distance must be a pointer to some object. It is the same as if you had written:
(*distance).distanceCM();
and dereferenced the pointer up front.
.
blh64
3
Delta_G:
-> is to call a method on an object from a pointer to it. So distance must be a pointer to some object. It is the same as if you had written:
(*distance).distanceCM();
and dereferenced the pointer up front.
C++ Member (dot & arrow) Operators
I think you mean the variable 'us' is the pointer....
(*us).distanceCM();
LarryD
4
BTW
If you Google: -> c++ you get 89 million hits.
Delta_G
5
blh64:
Yes I did. I definitely put those two names backwards.
Dyslexics untie!