@Rick
If I recreate your class in full:
Language: C++
class Context {
public:
Context(StrategyInterface *strategy);
private:
StrategyInterface *_strategy;
};
Context::Context(StrategyInterface *strategy)
: _strategy(strategy){ /// <<<<< your question is about this line
}
The syntax you're referring to is called the member initialisation list. This is a comma-separated list that can be used to initialise all the data members. The initialisation happens after any base classes have finished being constructed and before the code inside the constructor body is executed. It is optional for value types and pointers since you could have a bunch of assignment statements in the constructor body instead, but is mandatory for reference variables. References must be intact before the constructor body executes.
For classes that are derived from other classes, this is also the place that you forward any parameters to the base class' constructor. Note that the constructor of the base class must be first in the list (although some compilers tolerate any order) before any data members.