Hi, All !
I have a doubt regarding some syntax used in functors. For example, we have this:
[code]
class myFunctorClass
{
public:
myFunctorClass (int x) : _x( x ) {}
int operator() (int y) { return _x + y; }
private:
int _x;
}; [c/ode]
I know that the essential thing that makes one functor works is overloading the operator(), as shown in the code copied here above.
But my doubt is regarding the constructor syntax:
Code:
myFunctorClass (int x) : _x( x ) {}
The only syntax where I have seen that colon ( : ) in a constructor, is the syntax we use in a derived class to inherit from a base class whose constructor needs a parameter.
So, my question:
¿Which is the detailed meaning of this syntax?
Code:
myFunctorClass (int x) : _x( x ) {}
Thanks in advance!