The double colon thing :: is a puzzle.
Gimbal::seekTarget
The double colon thing :: is a puzzle.
Gimbal::seekTarget
Try googling c++ scoping operator.
@wildbill replied while I was writing, but I provide a little extra info so I'll post anyway:
:: is the C++ scope resolution operator:
So Gimbal is either the name of a class (including enum classes) or namespace.
thank you, i didnt know how to google it.
You're welcome. I'm glad if I was able to be of assistance.
It's often very challenging to find information about things like this if you don't know the correct terminology. Not having any formal training in these subjects, I have this problem a lot. I was actually surprised to get some pretty good results when I just tried a Google search for :: (though not as helpful if you don't know that Arduino language is based on C++). Not so great of results from a search for :: arduino, but at least you get the information that it is used with classes.
In the context of C++ Programming , I understand the meaning of :: (scope resolution operator) in this way:
1. In C++ Programming, we use class keyword to create a data type which contains variables and functions. For example:
class MyCustomClass //class is a keyword with strict defined meanings; MyCustomClass is a data type/tag
{
private:
int pin;
public;
MyCustomClass(int powerpin):pin(powerpin){}
void classSetup();
void powerOn();
void powerDown();
};
2. The functions of the MyCustomClass (the data type) must have definitions (what they do). This is the place where we use :: operator. For example:
void MyCustomClass::classSetup()
{
pinMode(pin, OUTPUT);
}
3. Now, the justification for the name 'scope resolution operator' for :: symbol.
operator: Yes, it is an operator as it is doing something which we can see in Step-2.
scope: It says about the scope (availability/visibility) of this function: classSetup().
resolution: ?