It is not part of some kind of “magic syntax”. Its just a static member that works like a factory for the Point class. I will copy the example from this link and add explanatory comments:
#include <cmath> // To get std::sin() and std::cos() class Point { public: static Point rectangular(float x, float y); // Its a static function that returns Point object static Point polar(float radius, float angle); // Its a static function that returns Point object // These static methods are the so-called "named constructors" ... private: Point(float x, float y); // Rectangular coordinates float x_, y_; }; inline Point::Point(float x, float y) : x_(x), y_(y) { } inline Point Point::rectangular(float x, float y) { return Point(x, y); } //Create new Point object and return it by value inline Point Point::polar(float radius, float angle) { return Point(radius*std::cos(angle), radius*std::sin(angle)); } //Create new Point object and return it by value
So Point::rectangular and Point::polar is just a factory for the Point class
source share