I will explain how this is working:
class HigPassFilter
{
public:
// Constructor of the class, with one parameter.
HigPassFilter(float reduced_frequency)
// initializer list initializes both data members of the class,
// 'alpha' will be set to the result of '1 - exp(-2 * PI*reduced_frequency)'
// and 'y' will be set to 0
: alpha(1 - exp(-2 * PI*reduced_frequency)), y(0)
// the body of the constructor is empty (good practice)
{}
// An overload of operator(), which performs a mathematical operation.
// It will increment 'y' by 'alpha * (x - y)' and
// return the difference of 'x' and 'y'
float operator()(float x) {
y += alpha * (x - y);
return x - y;
}
// a simple function that returns always 1 and
// will not used its parameter, causing an unused warning (bad practice)
int myfunc(bool x) { return 1; }
private:
// private data members
float alpha, y;
};
Read more in What is this weird colon-member (“ : ”) syntax in the constructor?. Initializer lists are a very important feature of C++, so I suggest you spend some time learning about them. Most of the times, you will initialize your data members in the initializer list-that's why this feature exists anyway.
Further reading: Why override operator()?